poj 3299 java

今天尝试一下poj平台 略有点忐忑 不知道自己能不能搞定。

上网查了一下poj题目推荐,所以从poj 3299题开始练手。

后来发现试了好几次都不成功,弄得我好郁闷,所以往1000这个sample里看看是什么出错,发现公共类public class 后面不应该写 “Humidex”而是要写”Main”。

初心者的才会犯的尴尬事情。

其次是自己编写的会造成Presentation Error ,美国服务器, 是因为输出结果格式不正确,后来略微调整一下就ok了。

记住一篇文章,是《POJ推荐50题以及ACM训练方案》 ,稍后转载,香港虚拟主机,毕竟是前人经验,香港虚拟主机,就跟着试试。

其次呢,是一个网址,《JAVA解北大ACM POJ源码》,

可以多多参考。

接下来是看了例题之后自己试着敲出的3299,试运行成功。

1 import java.io.BufferedInputStream; 2 import java.util.Scanner; Main{ main(String args[]){e = 2.718281828; 9 String alpha;1011Scanner cin = new Scanner(new BufferedInputStream(System.in));(cin.hasNext()){t=102,d=102,h=102;(int i =0; i<2;i++){19alpha = cin.next();(alpha.equals(“H”)){22h=cin.nextDouble();23}else if(alpha.equals(“D”)){24d=cin.nextDouble();25}else if (alpha.equals(“T”)) {26t=cin.nextDouble();27}else if (alpha.equals(“E”)) {28System.exit(0);2930 }31 }e2 = 6.11*Math.pow(e, 5417.7530 * ((1/273.16) – (1/(d+273.16))));(h==102){36h=t+0.5555*(e2-10.0);37System.out.print(“T “);38System.out.printf(“%.1f”, t);39System.out.print(” D “);40System.out.printf(“%.1f”, d);41System.out.print(” H “);42System.out.printf(“%.1f”, h);43 System.out.println(); 44 }45if(t==102){46t=h-0.5555*(e2-10.0);47System.out.print(“T “);48System.out.printf(“%.1f”, t);49System.out.print(” D “);50System.out.printf(“%.1f”, d);51System.out.print(” H “);52System.out.printf(“%.1f”, h);53 System.out.println();54 }55if(d==102){56e2=(h-t)/0.5555+10.0;57d=1/((1/273.16)-Math.log(e2/6.11)/5417.7530)-273.16;58d=(double)Math.round(d*10)/10;59System.out.print(“T “);60System.out.printf(“%.1f”, t);61System.out.print(” D “);62System.out.printf(“%.1f”, d);63System.out.print(” H “);64System.out.printf(“%.1f”, h);65 System.out.println();6667 }}7172 }73 }那我想明天可以是我的来世。

poj 3299 java

相关文章:

你感兴趣的文章:

标签云: