# Monthly Archives: February 2009

## Poj Solution 1011

http://poj.org/problem?id=1011 import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static boolean[] used; static int len; static int[] s; static int sum; static int max; static int parts; public static void main(String[] args) throws Exception { BufferedReader … Continue reading

## Poj Solution 1010

http://poj.org/problem?id=1010 //* @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[] arr=new int; int n=0; while(true) { int a=in.nextInt(); if(a==0)break; arr[n++]=a; } Arrays.sort(arr,0,n); while(true) { int a=in.nextInt(); if(a==0)break; int … Continue reading

## Poj Solution 1009

http://poj.org/problem?id=1009 //* @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,dtf,m,mn,cp,cpl; int[][] dt; while (true){ n=scanner.nextInt(); if (n==0){ break; } System.out.println(n); dt=new int; dtf=0; while (true){ dt[dtf]=scanner.nextInt(); dt[dtf]=scanner.nextInt(); … Continue reading

## Poj Solution 1008

http://poj.org/problem?id=1008 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int times = scan.nextInt(); System.out.println(times); int day; int day2; int t_day = 0; int t_month; String month; String month2; int year; int … Continue reading

## Poj Solution 1007

http://poj.org/problem?id=1007 import java.util.*; class DNA { private String str = null; private int sortNum = 0; public DNA(String input) { str = input; int num = 0; for(int i = 0; i < str.length()-1; i++) { for(int j = i+1; … Continue reading

## Poj Solution 1006

http://poj.org/problem?id=1006 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int k = 0; while (scan.hasNext()) { int p = scan.nextInt(); int e = scan.nextInt(); int i = scan.nextInt(); int d = … Continue reading

## Poj Solution 1005

http://poj.org/problem?id=1005 #include <stdio.h> #include <stdlib.h> #include <math.h> #define M_PI 3.14159265358979323846 #define DEBUG 0 int main(void) { if(DEBUG) freopen("in","r",stdin); int year,n,i=1; double x,y,radius,area; scanf("%d",&n); while(n–){ scanf("%lf%lf",&x,&y); radius=x*x+y*y; area=M_PI*radius/2.0; year=(int)ceil(area/50); printf("Property %d: ",i++); printf("This property will begin eroding in year %d.n",year); } … Continue reading

## Poj Solution 1004

http://poj.org/problem?id=1004 #include <iostream> using namespace std; int main(){ double d,t; while(cin>>d){ t+=d; } cout<<"\$"<<t/12; return 0; }

## Poj Solution 1003

http://poj.org/problem?id=1003 #include <stdio.h> #include <stdlib.h> #define DEBUG 0 int main(void) { if(DEBUG) freopen("in","r",stdin); float c; while(scanf("%f",&c)&&c!=0){ int i=2; float rs=0; while(rs<c){ rs+=1.0/i; i++; } printf("%d card(s)n",i-2); } return 0; }

## Poj Solution 1002

http://poj.org/problem?id=1002 #include<stdio.h> #include<stdlib.h> #include<string.h> #include<ctype.h> typedef struct BSTNode { char phoneName; int times; struct BSTNode *lchild,*rchild; }BSTNode,*BSTree; int count; void InsertBST(BSTree &t, char name[])//二叉排序树的插入,注意里面的BSTree &t { BSTree p,f; p = t;//指向树根 while(p) { if(strcmp(name,p->phoneName) == 0)//树中已有name值了,无需插入 { p->times++; count=1; return; … Continue reading