This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.cra.figaro.language.Flip | |
import com.cra.figaro.language.Select | |
import com.cra.figaro.library.compound.If | |
import com.cra.figaro.algorithm.factored.VariableElimination | |
object HelloWorld { | |
val sunnyToday = Flip(0.2); | |
val greetingToday = If(sunnyToday, | |
Select(0.6 -> "Hello World!", 0.4 -> "Howdy, universe!"), | |
Select(0.2 -> "Hello World!", 0.8 -> "Oh no, not again")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int minColors(int[] colors) | |
{ | |
boolean[] isDependence = new boolean[colors.length]; | |
Arrays.sort(colors); | |
for(int i=0;i<30;i++){ | |
for(int j=0;j<colors.length;j++){ | |
if(isDependence[j]) | |
continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Random; | |
public class StapCells { | |
public static void main(String[] args) { | |
StapCells p = new StapCells(); | |
p.create(); | |
} | |
public StapCells() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int maximumEarnings(int[] value, String[] earning) | |
{ | |
int res = 0; | |
int[][] e = new int[value.length][value.length]; | |
for(int i=0;i<value.length;i++){ | |
res -= value[i]; | |
for(int j=i;j<value.length;j++){ | |
e[i][j] = earning[i].charAt(j) - '0'; | |
e[j][i] = e[i][j]; | |
res += e[i][j]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int findSubset(int[] numbers) | |
{ | |
Arrays.sort(numbers); | |
int[] numCounts = new int[numbers[numbers.length-1]+1]; | |
for(int i=0;i<numbers.length;i++) | |
numCounts[numbers[i]]++; | |
if(numCounts[1] == 0) | |
return 0; | |
numCounts[1]--; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArrayList<ArrayList<Integer>> seqLens; | |
int xs; | |
int ys; | |
public int getNumber(String[] board) | |
{ | |
xs = board[0].length(); | |
ys = board.length; | |
seqLens = new ArrayList<ArrayList<Integer>>(); | |
for(int i=0;i<ys;i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int getmax(int[] X, int[] Y, int limit) | |
{ | |
ArrayList<Integer> x = new ArrayList<Integer>(); | |
ArrayList<Integer> y = new ArrayList<Integer>(); | |
// limitを超えないものを除外 | |
// 横長にする | |
// Yを降順にソート | |
for(int i=0;i<X.length;i++){ | |
if(X[i]*Y[i] < limit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int getNumber(int[] type) | |
{ | |
Arrays.sort(type); | |
int res; | |
int lastNum; | |
int curNumCount; | |
int lastComb; | |
if(type[0] != 1) |