# Monthly Archives: August 2012

## Poj Solution 2255

http://poj.org/problem?id=2255 import java.util.Scanner; public class Main { private static char[] seq = new char; private static int s = -1; public static void getPostOrder(String pre, String in) { if (pre.length() == 1 && in.length() == 1) { seq[++s] = in.charAt(0); … Continue reading

Posted in poj | Comments Off on Poj Solution 2255

## Poj Solution 2253

http://poj.org/problem?id=2253 //* @author //import java.io.File; //import java.io.FileNotFoundException; //import java.util.Arrays; import java.util.Scanner; public class Main{ Scanner cin = new Scanner(System.in); int n; int cases; int stone[][]; double map[][]; public void inPut() { //File f = new File("D:\ACM\POJ����\2253\test.txt"); // cin = new … Continue reading

Posted in poj | Comments Off on Poj Solution 2253

## Poj Solution 2251

http://poj.org/problem?id=2251 //* @author: import java.util.*; class point { int x; int y; int z; int step; public point(int x,int y,int z,int step){ this.x=x; this.y=y; this.z=z; this.step=step; } public int getX(){ return this.x; } public int getY(){ return this.y; } public … Continue reading

Posted in poj | Comments Off on Poj Solution 2251

## Poj Solution 2250

http://poj.org/problem?id=2250 import java.io.BufferedInputStream; import java.util.Scanner; public class Main{ private static final int MAXLEN = 101; private static int[][] c = new int[MAXLEN][MAXLEN]; private static int[][] b = new int[MAXLEN][MAXLEN]; public static void main(String[] args) { Scanner scan = new Scanner(new … Continue reading

Posted in poj | Comments Off on Poj Solution 2250

## Poj Solution 2249

http://poj.org/problem?id=2249 //* @author mekarlos@gmail.com import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static long[][] M=new long; public static long comb(int n,int k){ if(k>(n/2))k=n-k; if(n< 2000&&k< 2000) return M[n][k]; else if(k==n||k==0) return 1; else if(k==1) return n; … Continue reading

Posted in poj | Comments Off on Poj Solution 2249

## Poj Solution 2248

http://poj.org/problem?id=2248 /* @author: */ import java.util.Scanner; public class Main{ static int arr[]=new int; static int n,minn; static int save[]=new int; static void bfs(int a) { int i,j; if(a>=minn)return; if(arr[a-1]==n) { if(a< minn){ minn=a; for(i=0;i< a;i++) save[i]=arr[i]; } return; } for(i=a-1;i>=0;i–) … Continue reading

Posted in poj | Comments Off on Poj Solution 2248

## Poj Solution 2247

http://poj.org/problem?id=2247 //* @author: 82638882@163.com import java.util.*; public class Main { public static void main(String[] args) { TreeSet< Integer> t=new TreeSet< Integer>(); for(int i=0;i< 50;i++) { if(Math.pow(2, i)>2000000000) break; for(int j=0;;j++) { int ans2=(int)(Math.pow(2, i)*Math.pow(3, j)); if(ans2>2000000000) break; for(int k=0;;k++) { … Continue reading

Posted in poj | Comments Off on Poj Solution 2247

## Poj Solution 2245

http://poj.org/problem?id=2245 //* @author: 82638882@163.com import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); int count=0; while(true) { count++; if(count!=1) System.out.println(); int a=in.nextInt(); if(a==0) break; int[] b=new int[a]; for(int i=0;i< a;i++) b[i]=in.nextInt(); for(int a1=0;a1< a-5;a1++) … Continue reading

Posted in poj | Comments Off on Poj Solution 2245

## Poj Solution 2244

http://poj.org/problem?id=2244 //* @author: 82638882@163.com import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); while(true) { int n=in.nextInt(); if(n==0)break; int i,j,m=1; while(true) { i=0; j=n-1; while(j!=0) { i=(i+m-1)%j; j–; if(i==0) break; } if(j==0) { System.out.println(m); … Continue reading

Posted in poj | Comments Off on Poj Solution 2244

## Poj Solution 2243

http://poj.org/problem?id=2243 import java.util.*; public class Main { private static int[][] position = new int; private static int[][] chessboard = new int; public Main() { initPosition(); } /** * ��ʼ��������ߵķ��� */ private static void initPosition() { position = -2; position = … Continue reading

Posted in poj | Comments Off on Poj Solution 2243

## Poj Solution 2242

http://poj.org/problem?id=2242 //* @author popop0p0popo import java.util.*; import java.io.*; public class Main{ public static void main(String[] args){ Scanner scanner=new Scanner(new BufferedReader(new InputStreamReader(System.in))); double[] x,y; double k1,k2,b1,b2,ox,oy; double r; while (scanner.hasNext()){ x=new double; y=new double; for (int i=0;i< 3 ;i++ ){ x[i]=scanner.nextDouble(); … Continue reading

Posted in poj | Comments Off on Poj Solution 2242

## Poj Solution 2241

http://poj.org/problem?id=2241 import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { Scanner cin = new Scanner(System.in); int kase = 0; while (true) { int n … Continue reading

Posted in poj | Comments Off on Poj Solution 2241

## Poj Solution 2240

http://poj.org/problem?id=2240 import java.util.*; public class Main { static int c=0; static String[] str; static double[][] map; static double[] v; static int n,m; static boolean[] visited; public static void main(String[] args){ Main p=new Main(); Scanner cin=new Scanner(System.in); while(true){ c++; n=cin.nextInt(); if(n==0) … Continue reading

Posted in poj | Comments Off on Poj Solution 2240