# Monthly Archives: November 2015

## Poj Solution 3366

http://poj.org/problem?id=3366 //* @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(); int b=in.nextInt(); String[] s1=new String[a]; String[] s2=new String[a]; for(int i=0;i< a;i++) { s1[i]=in.next(); s2[i]=in.next(); } for(int i=0;i< b;i++) { … Continue reading

Posted in poj | Comments Off on Poj Solution 3366

## Poj Solution 3365

http://poj.org/problem?id=3365 /* @author: */ //����һ�ų�ΪH��Ϊw��ֽ��Ҫ����һ���������Բ����ʹ����Բ�İ뾶���� //���}�����һ����wΪ����Բ���ܳ���һ����H-2RΪ����Բ���ܳ���Ȼ��ȡ���ֵ�ͺ��� import java.util.Scanner; import java.util.Arrays; public class Main{ static double pi=Math.PI; static double epx=1e-6; public static void main(String args[]){ Scanner sc=new Scanner(System.in); double w,h,v1,v2,temp,r,d; while(sc.hasNext()){ w=sc.nextDouble(); h=sc.nextDouble(); if(w==0&&h==0) break; if(h>w){temp=h;h=w;w=temp;} v1=h*h*(w-h/pi)/(4.0*pi); d=w/(pi+1); if(d>h+epx){/*�ж�d�Ƿ������*/ r=h/2.0; v2=pi*r*r*h; … Continue reading

Posted in poj | Comments Off on Poj Solution 3365

## Poj Solution 3364

http://poj.org/problem?id=3364 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,m,c; while(sc.hasNext()){ n=sc.nextInt(); if(n==0) break; m=sc.nextInt(); c=sc.nextInt(); int t=(m-7)*(n-7); int t1=(t+1)/2; if (c==0) System.out.printf("%dn",t-t1); else System.out.printf("%dn",t1); } } }

Posted in poj | Comments Off on Poj Solution 3364

## Poj Solution 3356

Posted in poj | Comments Off on Poj Solution 3356

## Poj Solution 3352

http://poj.org/problem?id=3352 //* @author: 82638882@163.com import java.io.*; public class Main { static int a,cnt=1; static int[] rank,un; static boolean[][] map; public static void main(String[] args) throws NumberFormatException, IOException { InputStreamReader is=new InputStreamReader(System.in); BufferedReader in=new BufferedReader(is); String[] ss=in.readLine().split(" "); a=Integer.parseInt(ss); map=new boolean[a+1][a+1]; … Continue reading

Posted in poj | Comments Off on Poj Solution 3352

## Poj Solution 3349

http://poj.org/problem?id=3349 //* @author: import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Node { int index; Node next; } public class Main { static BufferedReader cin = new BufferedReader(new InputStreamReader(System.in)); final int N=9997; int [][]snow=new int; boolean check(int s1,int s2) … Continue reading

Posted in poj | Comments Off on Poj Solution 3349

## Poj Solution 3340

http://poj.org/problem?id=3340 //* @author ������&lt;hongxp11@163.com&gt; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { /** * @param args * @throws IOException */ public static int count(String a, String b) { int len = a.length(); int result = 1; for (int … Continue reading

Posted in poj | Comments Off on Poj Solution 3340

## Poj Solution 3332

http://poj.org/problem?id=3332 import java.util.regex.*;import java.util.*; public class Main { public static void main(String[] args){ String str; int n; Scanner cin = new Scanner(System.in); n=cin.nextInt(); str=cin.nextLine(); Pattern pattern = Pattern.compile("(\s)*(\+|\-)?(\d)+(\.(\d)+)?((e|E)(\+|\-)?(\d)+)?"); int i; for(i=0;i< n;++i){ str=cin.nextLine(); Matcher matcher = pattern.matcher(str); if(matcher.matches()){ System.out.println("LEGAL"); } … Continue reading

Posted in poj | Comments Off on Poj Solution 3332

## Poj Solution 3331

http://poj.org/problem?id=3331 import java.io.BufferedInputStream; import java.math.BigDecimal; import java.util.Scanner; /** * * poj3331 * @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(); for (int … Continue reading

Posted in poj | Comments Off on Poj Solution 3331

## Poj Solution 3325

http://poj.org/problem?id=3325 import java.util.*; import java.text.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); while(true) { int num = cin.nextInt(); if(num == 0) break; int[] list = new int[num]; int max = 0; int … Continue reading

Posted in poj | Comments Off on Poj Solution 3325

## Poj Solution 3324

http://poj.org/problem?id=3324 //* @author: ccQ.SuperSupper import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String args[]) throws Exception { Scanner cin=new Scanner(System.in); BigInteger s,M; int p,i; while(cin.hasNext()) { p=cin.nextInt(); s=BigInteger.valueOf(4); M=BigInteger.ONE; M=M.shiftLeft(p).subtract(BigInteger.ONE); for(i=0;i< p-2;++i) { s=s.multiply(s).subtract(BigInteger.valueOf(2)); while(s.bitLength()>p) … Continue reading

Posted in poj | Comments Off on Poj Solution 3324