# 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,g=0;g< b;g++) { if(d>c[g])d=c[g]; … Continue reading

Posted in poj | Comments Off on Poj Solution 3632

## 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 | Comments Off on Poj Solution 3630

## 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 | Comments Off on Poj Solution 3628

## 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 | Comments Off on Poj Solution 3627

## 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; static int … Continue reading

Posted in poj | Comments Off on Poj Solution 3626

## Poj Solution 3625

Posted in poj | Comments Off on Poj Solution 3625

## 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); b=Integer.parseInt(ss); p=new int[a+1]; q=new int[a+1]; for(int … Continue reading

Posted in poj | Comments Off on Poj Solution 3624

## 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 | Comments Off on Poj Solution 3619

## 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 | Comments Off on Poj Solution 3601

## 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 | Comments Off on Poj Solution 3589

## 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 | Comments Off on Poj Solution 3536

## 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 | Comments Off on Poj Solution 3522

## 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; Arrays.fill(prime,true); prime = false; prime = false; for(int i=2; i<=10000; ++i){ if(prime[i]) for (int j=i; i*j< 1299710; ++j) … Continue reading

Posted in poj | Comments Off on Poj Solution 3518

## 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); k=Integer.parseInt(ss); m=Integer.parseInt(ss); if(n==0) break; System.out.println((f(n-1)+m)%n+1); } } static … Continue reading

Posted in poj | Comments Off on Poj Solution 3517