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.List; | |
import java.util.ArrayList; | |
public class Question201994 { | |
public static void main (String [] args) { | |
List<Integer> masks = new ArrayList<Integer> (); | |
for (int bits = 0;bits < 1 << 27;bits++) { | |
int count = 0; | |
int r1 = 0; | |
int r2 = 0; |
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 class Question202862 { | |
final static int nfeatures = 4; | |
final static int nvalues = 3; | |
final static int ncards = (int) Math.pow (nvalues,nfeatures); | |
static int thirdFeature (int f1,int f2) { | |
return f1 == f2 ? f1 : 3 - (f1 + f2); | |
} | |
static int thirdCard (int c1,int c2) { |
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; | |
import java.util.Arrays; | |
import java.util.Locale; | |
public class Question188889 { | |
static Random random = new Random (); | |
static int [] coupons; | |
static int [] counts; | |
static int couponCount; |
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.math.BigInteger; | |
import java.util.Random; | |
public class Question211687 { | |
final static int n = 100; | |
final static int m = 10; | |
final static int perKind = 100; | |
final static int min = 8; | |
final static int max = 12; |
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 Question218234 { | |
final static Random random = new Random (); | |
static double exponential (double mu) { | |
return -Math.log (random.nextDouble ()) / mu; | |
} | |
final static double lambda = 2; |
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 class Question219552 { | |
public static void main (String [] args) { | |
for (int n = 2;;n += 2) { | |
int n2 = n >> 1; | |
long count = 0; | |
for (long bits = 0;bits < 1L << n;bits++) { | |
outer: | |
for (int l = 1;l <= n2;l++) { | |
for (int bit = 0;bit < l;bit++) |
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.List; | |
import java.util.ArrayList; | |
import java.util.Map; | |
import java.util.HashMap; | |
public class Question216503 { | |
final static int n = 5; | |
final static int [] weights = {0,1,n+1}; | |
static class State { |
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.Arrays; | |
public class Question227990 { | |
final static int nbirds = 5; | |
final static int ntrials = 10000000; | |
static double [] birds = new double [nbirds]; | |
static double length (int index) { | |
double length = birds [(index + nbirds) % nbirds] - birds [(index + nbirds - 1) % nbirds]; | |
return length < 0 ? length + 1 : length; |
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.Set; | |
import java.util.HashSet; | |
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
public class Question231199 { | |
final static double [] times = {1,2,5,10}; | |
static List<Double> results = new ArrayList<Double> (); | |
static Set<Integer> west = new HashSet<Integer> (); |
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 Question245122 { | |
final static Random random = new Random (); | |
public static void main (String [] args) { | |
int N = Integer.parseInt (args [0]); | |
int ntrials = Integer.parseInt (args [1]); | |
int count = 0; |