ITeye博客

pku1005

fullfocus · 2007-10-28 17:25 · 算法和数据结构 · Markdown

//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. public class Pku1005 {
  7. /**
  8. * @param args
  9. */
  10. double semisquare(double x, double y)
  11. {
  12. double length = Math.sqrt(x*x + y*y);
  13. return Math.PI * length *length/2;
  14. }
  15. public static void main(String[] args) {
  16. // TODO Auto-generated method stub
  17. Scanner cin = new Scanner(new BufferedInputStream(System.in));
  18. Pku1005 pku1005 = new Pku1005();
  19. int n = cin.nextInt();
  20. double x = 0, y = 0;
  21. double square = 0.0;
  22. double temp = 0.0;
  23. int i = 1;
  24. while(i <= n)
  25. {
  26. x = cin.nextDouble();
  27. y = cin.nextDouble();
  28. square = pku1005.semisquare(x, y);
  29. System.out.println("Property "+ i +": This property will begin eroding in year "+ (int)(square/50+1) +".");
  30. i++;
  31. }
  32. System.out.println("END OF OUTPUT.");
  33. }
  34. }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。