This file contains hidden or 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 Question4390194 { | |
| final static Random random = new Random(); | |
| final static int ntrials = 100000000; | |
| final static int [] [] families = { | |
| {2,4,6}, | |
| {2,3,5}, |
This file contains hidden or 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.io.FileOutputStream; | |
| import java.io.IOException; | |
| import java.io.PrintStream; | |
| import java.util.Random; | |
| public class Question4390837 { | |
| final static int a = 2; | |
| final static int b = 2; | |
| final static int ntrials = 100000000; |
This file contains hidden or 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.io.File; | |
| import java.io.IOException; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.List; | |
| import java.util.Map; | |
| import java.util.regex.Matcher; | |
| import java.util.regex.Pattern; |
This file contains hidden or 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.HashSet; | |
| import java.util.Set; | |
| public class Question3706460 { | |
| public static void main(String [] args) { | |
| Set<Long> strings = new HashSet<>(); | |
| strings.add(1L); | |
| long bit = 2; | |
| boolean one = false; | |
| for (int n = 1;;n++,bit <<= 1,one = !one) { |
This file contains hidden or 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 Question3674864 { | |
| final static long ntrials = 10000000; | |
| final static Random random = new Random(); | |
| public static void main (String [] args) { | |
| long count = 0; | |
| for (long trial = 0;trial < ntrials;trial++) { | |
| int [] state = new int [6]; |
This file contains hidden or 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; | |
| public class Question3674784 { | |
| public static void main(String [] args) { | |
| for (int n = 1;;n++) { | |
| System.out.println(n); | |
| BigInteger diff = BigInteger.TEN.pow(n).subtract(BigInteger.ONE).divide(BigInteger.TEN.subtract(BigInteger.ONE)); | |
| BigInteger x = BigInteger.TWO; | |
| BigInteger x2 = x.multiply(x); | |
| BigInteger y = BigInteger.ONE; |
This file contains hidden or 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.ArrayList; | |
| import java.util.Iterator; | |
| import java.util.List; | |
| import java.util.Random; | |
| public class Question3667404 { | |
| final static long ntrials = 10000000; | |
| final static Random random = new Random(); | |
| static class Range { |
This file contains hidden or 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 Question3664030 { | |
| public static void main(String [] args) { | |
| for (int n = 1;n < 2000;n++) { | |
| int count = 0; | |
| boolean [] hit = new boolean [n]; | |
| for (int k = 1;k <= n + 1;k++) { | |
| double x = 1. / k; | |
| // to count values on boundaries only towards the lower interval, subtract 1e-12 here ... | |
| int index = (int) (n * x); | |
| if (index < n && !hit [index]) { |
This file contains hidden or 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.ArrayList; | |
| import java.util.Arrays; | |
| import java.util.List; | |
| public class Question3629762 { | |
| static class Constraint { | |
| int [] cells; | |
| int sum; | |
| public Constraint(int [] cells) { |
This file contains hidden or 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 Question3629474 { | |
| final static long ntrials = 100000000; | |
| final static Random random = new Random(); | |
| public static void main(String [] args) { | |
| double sum = 0; | |
| for (long n = 0;n < ntrials;n++) | |
| sum += Math.abs(angle() - angle()); |