Monthly Archives: February 2016

Poj Solution 3516

http://poj.org/problem?id=3516 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; class Queue{ int pre; int cnt_posi; int cnt_num; int cnt_sum; void set(int pre_t,int cnt_num_t,int cnt_sum_t,int cnt_posi_t){ this.pre = pre_t; this.cnt_num = cnt_num_t; this.cnt_sum = cnt_sum_t; this.cnt_posi = cnt_posi_t; } } class node{ … Continue reading

Posted in poj | Comments Off on Poj Solution 3516

Poj Solution 3512

http://poj.org/problem?id=3512 //* @author: 82638882@163.com import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); String[] ss; String s; int count=0; while(true) { count++; node[] arr=new node[1001]; node[] pp=new … Continue reading

Posted in poj | Comments Off on Poj Solution 3512

Poj Solution 3511

http://poj.org/problem?id=3511 //* @author mekarlos@gmail.com import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws IOException{ BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokens; int[] prims=new int[1000001]; int[] ferms=new int[1000001]; for(int i=3;i< 1000000;i+=2) prims[i]=1; prims[2]=1; … Continue reading

Posted in poj | Comments Off on Poj Solution 3511

Poj Solution 3510

http://poj.org/problem?id=3510 //* @author: 82638882@163.com import java.util.*; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); while(true) { String s=in.nextLine(); StringBuffer sb=new StringBuffer(""); int l=s.length(); boolean bb=false; for(int i=0;i< l;i++) { char c=s.charAt(i); if(i< l-1&&c==’d’&&s.charAt(i+1)==’d’){ sb.append(‘p’); i++; … Continue reading

Posted in poj | Comments Off on Poj Solution 3510

Poj Solution 3508

http://poj.org/problem?id=3508 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)); int num = 1; int flg, tt, last; while (true) { char[] c = … Continue reading

Posted in poj | Comments Off on Poj Solution 3508

Poj Solution 3507

http://poj.org/problem?id=3507 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); float[] input = new float[6]; while(true) { input[0] = in.nextFloat(); float max = input[0]; float min = input[0]; float sum = input[0]; … Continue reading

Posted in poj | Comments Off on Poj Solution 3507

Poj Solution 3505

http://poj.org/problem?id=3505 //* @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 nn,n,m,ans; nn=sc.nextInt(); while((nn–)!=0) { n=sc.nextInt(); m=sc.nextInt(); int a[][]=new int[n+1][m+1]; ans=0; for (int i=1;i<=n;i++) { for (int j=1;j<=m;j++) a[i][j]=sc.nextInt(); int tp=0,now=1,t1,t2; for … Continue reading

Posted in poj | Comments Off on Poj Solution 3505

Poj Solution 3504

http://poj.org/problem?id=3504 //* @author:alpc12 import java.util.*; public class Main { public static Scanner in=new Scanner(System.in).useLocale(Locale.US); public void run() { boolean[] singles=new boolean[26]; Map< String,String>[][] words=new Map[26][26]; for(int i=0;i< 26;++i) for(int j=0;j< 26;++j) words[i][j]=new HashMap< String,String>(); Set< String>[][] doublewords=new Set[26][26]; for(int i=0;i< … Continue reading

Posted in poj | Comments Off on Poj Solution 3504

Poj Solution 3488

http://poj.org/problem?id=3488 //* @author: import java.util.*; import java.math.*; import java.io.FileReader; public class Main { public static void main(String[] args) throws Exception{ Scanner in=new Scanner(System.in); while (true) { int n; try { n=in.nextInt(); } catch(Exception e) {return;} String []s=new String [n]; for … Continue reading

Posted in poj | Comments Off on Poj Solution 3488

Poj Solution 3486

http://poj.org/problem?id=3486 /* @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 n,c; int m[][]=new int[1003][1003]; int f[]=new int[1003]; while(sc.hasNext()){ c=sc.nextInt(); n=sc.nextInt(); for(int i=0;i< m.length;i++) Arrays.fill( m[i],0); for(int … Continue reading

Posted in poj | Comments Off on Poj Solution 3486

Poj Solution 3485

http://poj.org/problem?id=3485 //* @author: import java.util.*; import java.math.*; import java.io.FileReader; class SEG implements Comparable<SEG> { double b,e; SEG(double x,double y) { b=x;e=y; } public int compareTo(SEG other) { if (b< other.b) return -1; else if (b==other.b) { if (e< other.e) return … Continue reading

Posted in poj | Comments Off on Poj Solution 3485

Poj Solution 3484

http://poj.org/problem?id=3484 //* @author: import java.util.*; import java.math.*; import java.io.FileReader; class node{ int x,y,z; node(String s) { int t=0,cnt=0; for (int i=0;i<=s.length();i++) { if (i!=s.length()&&s.charAt(i)>=’0’&&s.charAt(i)<=’9′) { t=t*10+s.charAt(i)-‘0’; } else { if (cnt==0) x=t; else if (cnt==1) y=t; else if (cnt==2) z=t; … Continue reading

Posted in poj | Comments Off on Poj Solution 3484