2007-10-28

pku1005

关键字: ACM
//http://acm.pku.edu.cn/JudgeOnline/
java 代码
 
  1. //http://acm.pku.edu.cn/JudgeOnline/  
  2. package com.pku;  
  3. import java.io.*;  
  4. import java.util.*;  
  5. import java.lang.Math;  
  6.   
  7. public class Pku1005 {  
  8.   
  9.         /** 
  10.          * @param args 
  11.          */  
  12.         double semisquare(double x, double y)  
  13.         {  
  14.             double length = Math.sqrt(x*x + y*y);  
  15.             return Math.PI * length *length/2;  
  16.         }  
  17.         public static void main(String[] args) {  
  18.             // TODO Auto-generated method stub  
  19.             Scanner cin = new Scanner(new BufferedInputStream(System.in));  
  20.             Pku1005 pku1005 = new Pku1005();  
  21.             int n = cin.nextInt();  
  22.             double x = 0, y = 0;  
  23.             double square = 0.0;  
  24.             double temp = 0.0;  
  25.             int i = 1;      
  26.             while(i <= n)  
  27.             {  
  28.                 x = cin.nextDouble();  
  29.                 y = cin.nextDouble();  
  30.                 square = pku1005.semisquare(x, y);  
  31.                 System.out.println("Property "+ i +": This property will begin eroding in year "+ (int)(square/50+1) +".");  
  32.                 i++;                      
  33.             }  
  34.             System.out.println("END OF OUTPUT.");  
  35.         }  
  36.   
  37. }  
评论
发表评论

您还没有登录,请登录后发表评论

fullfocus
搜索本博客
最近加入圈子
存档
最新评论