Monthly Archives: March 2016

Poj Solution 3632

http://poj.org/problem?id=3632 //* @author: 82638882@163.com import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); int a=in.nextInt(); while(a!=0) { int b=in.nextInt(); int[] c=new int[b]; for(int i=0;i< b;i++) { c[i]=in.nextInt(); } int d,e,g; for(d=e=c[0],g=0;g< b;g++) { if(d>c[g])d=c[g]; … Continue reading

Posted in poj | Leave a comment

Poj Solution 3630

http://poj.org/problem?id=3630 import java.util.Scanner; public class Main { private static Trie trie = new Trie(); private static boolean isConsistent = true; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; … Continue reading

Posted in poj | Leave a comment

Poj Solution 3628

http://poj.org/problem?id=3628 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; public class Main { static int n, b; static int[] h; static boolean[] used; static int min = Integer.MAX_VALUE; public static void main(String[] args) throws Exception { BufferedReader read = new BufferedReader(new InputStreamReader( … Continue reading

Posted in poj | Leave a comment

Poj Solution 3627

http://poj.org/problem?id=3627 //* @author import java.io.*; import java.util.*; import java.math.*; public class Main { static int[] bookHeight; static int n; static BigInteger b; public static void main(String[] args) throws Exception { readFile(); } public static void readFile() throws Exception { BufferedReader … Continue reading

Posted in poj | Leave a comment

Poj Solution 3626

http://poj.org/problem?id=3626 //* @author: import java.io.BufferedInputStream; import java.util.LinkedList; import java.util.Scanner; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ public class Main { static int[][] field = new int[1001][1001]; static int … Continue reading

Posted in poj | Leave a comment

Poj Solution 3625

http://poj.org/problem?id=3625 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader read = new BufferedReader(new InputStreamReader( System.in)); String[] s = read.readLine().split(" "); int n = Integer.parseInt(s[0]); int m = Integer.parseInt(s[1]); int … Continue reading

Posted in poj | Leave a comment

Poj Solution 3624

http://poj.org/problem?id=3624 //* @author: 82638882@163.com import java.io.*; public class Main { static int[] p,q,d; static int a,b; public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); String[] ss=in.readLine().split(" "); a=Integer.parseInt(ss[0]); b=Integer.parseInt(ss[1]); p=new int[a+1]; q=new int[a+1]; for(int … Continue reading

Posted in poj | Leave a comment

Poj Solution 3619

http://poj.org/problem?id=3619 import java.util.*; import java.io.*; /* * n ����; * s[i] ÿ���ӿ���ɵĹ��� * t[i] һ����l��������ֵ�ʱ�� * r[i] һ��l�������Ҫ��Ϣ��ʱ�� */ public class Main{ public static void main(String rgs[]) throws Exception { BufferedReader stdin = new BufferedReader( new InputStreamReader(System.in)); String line = … Continue reading

Posted in poj | Leave a comment

Poj Solution 3601

http://poj.org/problem?id=3601 //* @author popop0p0popo import java.util.*; import java.io.*; public class Main{ public static int step; public static int[] h; public static void main(String[] args){ Scanner scanner=new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n,m; while (scanner.hasNext()){ n=scanner.nextInt(); m=scanner.nextInt(); step=0; h=new int[n]; for (int … Continue reading

Posted in poj | Leave a comment

Poj Solution 3589

http://poj.org/problem?id=3589 //* @author ������&lt;hongxp11@163.com&gt; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = Integer.parseInt(in.nextLine()); for(int j = 0; j< n; j++) { String first = in.next(); String second = … Continue reading

Posted in poj | Leave a comment

Poj Solution 3536

http://poj.org/problem?id=3536 //* @author: 82638882@163.com import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); while(in.hasNext()) { int a=in.nextInt(); int x=1,y=1,z=a,m=1,n=1,q=a; for(int i=(int)Math.pow(a,1.0/3)+1;i>0;i–) { if(a%i==0) { x=i; for(int j=(int)Math.sqrt(a/x)+1;j>0;j–) { if((a/x)%j==0) { y=j; z=a/x/j; if(x*y+y*z+z*x< m*n+n*q+q*m) … Continue reading

Posted in poj | Leave a comment

Poj Solution 3522

http://poj.org/problem?id=3522 //* @author: import java.io.*; import java.util.*; /*�����������Ȩֵ����СȨֵ����С��: *��˼��:�ȶԱ�����. ���������ڵ�һ����������,��¼���Ȩֵ����СȨֵ����С��,ö��������� *��α�֤�������������Ž���,��Ϊ���Ѿ���Ȩֵ��������,���ڵ�һ�����ɵ����Ȼ����С��(�Ͻ���½�֮����С) */ class cin { static BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); static int a,c; static int nextInt() throws IOException { c=in.read(); a=0; while(c==’ ‘||c==’r’||c==’n’)c=in.read(); while(c!=’ ‘&&c!=’r’&&c!=’n’) { a=a*10+c-‘0’; c=in.read(); } return … Continue reading

Posted in poj | Leave a comment

Poj Solution 3518

http://poj.org/problem?id=3518 //* @author popop0p0popo import java.util.*; import java.io.*; public class Main{ public static void main(String rgs[]) throws Exception { boolean[] prime=new boolean[1299710]; Arrays.fill(prime,true); prime[1] = false; prime[0] = false; for(int i=2; i<=10000; ++i){ if(prime[i]) for (int j=i; i*j< 1299710; ++j) … Continue reading

Posted in poj | Leave a comment

Poj Solution 3517

http://poj.org/problem?id=3517 //* @author: 82638882@163.com import java.io.*; class Main { static int n,k,m; public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); while(true) { String[] ss=in.readLine().split(" "); n=Integer.parseInt(ss[0]); k=Integer.parseInt(ss[1]); m=Integer.parseInt(ss[2]); if(n==0) break; System.out.println((f(n-1)+m)%n+1); } } static … Continue reading

Posted in poj | Leave a comment