Monthly Archives: January 2012

Poj Solution 2035

http://poj.org/problem?id=2035 /* @author: */ import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String args[]) { Scanner sc=new Scanner(System.in); int c[][]=new int[11][53],p[]=new int[11],r[]=new int[2],d[]=new int[11],count[]=new int[11]; int casen,i,j,k,pn,top,discard,noanswer; casen=sc.nextInt(); for(k=1;k<=casen;k++) { pn=sc.nextInt(); for(i=0;i< pn;i++){count[i]=c[i][0]=0;p[i]=1;} c[0][0]=52;top=0;noanswer=0;r[0]=r[1]=0; for(i=1;i<=52;i++) c[0][i]=sc.nextInt(); while(top< pn&&c[top][0]!=0) … Continue reading

Posted in poj | Leave a comment

Poj Solution 2033

http://poj.org/problem?id=2033 //* @author: 82638882@163.com import java.io.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); while(true) { String s=in.readLine(); if(s.equals("0")) break; int l=s.length(); int[] arr=new int[l]; int count=0; for(int i=0;i< l-1;i++) … Continue reading

Posted in poj | Leave a comment

Poj Solution 2031

http://poj.org/problem?id=2031 //* @author: 82638882@163.com import java.io.*; import java.util.Arrays; public class Main { static int[] p; public static void main(String[] args) throws NumberFormatException, IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); while(true) { int a=Integer.parseInt(in.readLine()); if(a==0)break; double[][] dd=new double[a][4]; for(int i=0;i< … Continue reading

Posted in poj | Leave a comment

Poj Solution 2029

http://poj.org/problem?id=2029 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; public class Main { /** * @param args */ static int max(int a,int b) { if(a>b) return a; return b; } public static void main(String[] args) { // TODO Auto-generated method stub … Continue reading

Posted in poj | Leave a comment

Poj Solution 2028

http://poj.org/problem?id=2028 //* @author ������&lt;hongxp11@163.com&gt; import java.awt.Label; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Scanner; import java.util.Set; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while (true) { int n = in.nextInt(); int q … Continue reading

Posted in poj | Leave a comment

Poj Solution 2027

http://poj.org/problem?id=2027 import java.util.Scanner; /** * POJ2027 easy * @author NC */ public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); if (scan.hasNext()) { int n = scan.nextInt(); for (int i = 0; i < … Continue reading

Posted in poj | Leave a comment

Poj Solution 2019

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

Posted in poj | Leave a comment

Poj Solution 2018

http://poj.org/problem?id=2018 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; public class Main { static int n,k; static final int N = 100000+100,que[] = new int[N]; static double DP[] = new double[N] , sum[] = new double[N]; public static int Get_Num(StreamTokenizer cin) … Continue reading

Posted in poj | Leave a comment

Poj Solution 2017

http://poj.org/problem?id=2017 import java.io.BufferedInputStream; import java.util.Scanner; /** *poj2017 * @author NC */ public class Main { public static void main(String[] args) { Scanner scan = new Scanner(new BufferedInputStream(System.in)); while (scan.hasNext()) { int n = scan.nextInt(); if (n == -1) { break; … Continue reading

Posted in poj | Leave a comment

Poj Solution 2014

http://poj.org/problem?id=2014 //* @author: import java.util.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); int max_width; while((max_width=cin.nextInt())!=0){ int final_width=0; int final_height=0; int remain=max_width; int cur_height=0; int r_width=cin.nextInt(); int r_height=cin.nextInt(); while(r_width!=-1){ if(r_width<=remain){ remain-=r_width; if(final_width< max_width-remain) … Continue reading

Posted in poj | Leave a comment

Poj Solution 2013

http://poj.org/problem?id=2013 //* @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))); int n; String[] s; int index=1; while (true){ n=scanner.nextInt(); if (n==0){ break; } System.out.println("SET "+index); index++; s=new String[n]; for … Continue reading

Posted in poj | Leave a comment