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.ArrayList; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.HashSet; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.NoSuchElementException; | |
import java.util.Set; | |
import java.util.Stack; |
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.Map; | |
import java.util.TreeMap; | |
public class Question107694 { | |
final static int n = 7; | |
static boolean handle (Map<Integer,String> newExpressions,String ej,String ek,int result,char op) { | |
boolean isNew = !newExpressions.containsKey (result); | |
if (isNew) | |
newExpressions.put (result,"(" + ej + ")" + op + "(" + ek + ")"); |
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
// This version counts the transitions by tallying the different ways in which the scrambling can rearrange the cycles | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.ArrayList; | |
import java.util.Map; | |
import java.util.HashMap; | |
class Partition { | |
List<Integer> parts = new ArrayList<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 Question118566 { | |
public static void main (String [] args) { | |
double lambda0 = Double.parseDouble (args [0]); | |
double k0 = Double.parseDouble (args [1]); | |
double lambda1 = Double.parseDouble (args [2]); | |
double k1 = Double.parseDouble (args [3]); | |
int ntrials = 100000; |
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.ArrayList; | |
import java.util.List; | |
public class Question129580 { | |
static List<int []> getPermutations (int n) { | |
return getPermutations (n,n); | |
} | |
static List<int []> getPermutations (int n,int k) { | |
List<int []> permutations = new ArrayList<int[]> (); |
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
// Count the number of tilings of an n by n square with n rectangles of integer sides and area n | |
// See http://math.stackexchange.com/questions/130758 | |
public class Question130758 { | |
final static int maxn = 100; | |
static int n; | |
static int [] divisors = new int [maxn]; | |
static int ndivisors; | |
static boolean [] [] grid; |
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; | |
public class Question132847 { | |
static int n; | |
static int count; | |
static Set<String> pairs = new HashSet<String> (); | |
public static void main (String [] args) { |
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 Question33227 { | |
public static void main (String [] args) { | |
int n = Integer.parseInt (args [0]); | |
int n2 = n / 2; | |
int [] d = new int [n]; | |
for (int i = 0;i < d.length;i++) | |
d [i] = -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
import java.util.BitSet; | |
public class Question177465 { | |
static BitSet [] bits = {new BitSet (),new BitSet ()}; | |
static int [] polynomials = {Integer.parseInt ("1011011",2),Integer.parseInt ("1111001",2)}; | |
public static void main (String [] args) { | |
bits [0] = new BitSet (); | |
bits [1] = new BitSet (); |
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.Random; | |
public class Question176383 { | |
public final static Centre origin = new Centre (0,0); | |
static List<Centre> centres = new ArrayList<Centre> (); | |
static enum Ternary { |
OlderNewer