首页 > 新闻动态 >  

新闻动态
NEWS

poj 3299 java

添加时间:2013-8-6 点击量:

今天测验测验一下poj平台 略有点忐忑 不知道本身能不克不及搞定。


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


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


初心者的才会犯的难堪工作。


其次是本身编写的会造成 Presentation Error , 是因为输出成果格局不正确,后来略微调剂一下就ok了。



记住一篇文章,是《 POJ推荐50题以及ACM练习规划》 ,稍后转载,毕竟?成果是前人经验,就跟着尝尝。


其次呢,是一个网址,《JAVA解北大ACM POJ源码》,http://www.java3z.com/cwbwebhome/article/article17/POJ3.html


可以多多参考。


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




 1 import java.io.BufferedInputStream;

2 import java.util.Scanner;
3
4
5 public class Main{
6 public static void main(String args[]){
7
8 double e = 2.718281828;
9 String alpha;
10
11 Scanner cin = new Scanner(new BufferedInputStream(System.in));
12
13
14 while(cin.hasNext()){
15
16 double t=102,d=102,h=102;
17
18 forint i =0; i<2;i++){
19 alpha = cin.next();
20
21 if(alpha.equals(H)){
22 h=cin.nextDouble();
23 }else if(alpha.equals(D)){
24 d=cin.nextDouble();
25 }else if (alpha.equals(T)) {
26 t=cin.nextDouble();
27 }else if (alpha.equals(E)) {
28 System.exit(0);
29
30 }
31 }
32
33 double e2 = 6.11Math.pow(e, 5417.7530 ((1/273.16) - (1/(d+273.16))));
34
35 if(h==102){
36 h=t+0.5555(e2-10.0);
37 System.out.print(T );
38 System.out.printf(%.1f, t);
39 System.out.print( D );
40 System.out.printf(%.1f, d);
41 System.out.print( H );
42 System.out.printf(%.1f, h);
43 System.out.println();
44 }
45 if(t==102){
46 t=h-0.5555(e2-10.0);
47 System.out.print(T );
48 System.out.printf(%.1f, t);
49 System.out.print( D );
50 System.out.printf(%.1f, d);
51 System.out.print( H );
52 System.out.printf(%.1f, h);
53 System.out.println();
54 }
55 if(d==102){
56 e2=(h-t)/0.5555+10.0;
57 d=1/((1/273.16)-Math.log(e2/6.11)/5417.7530)-273.16;
58 d=(double)Math.round(d10)/10;
59 System.out.print(T );
60 System.out.printf(%.1f, t);
61 System.out.print( D );
62 System.out.printf(%.1f, d);
63 System.out.print( H );
64 System.out.printf(%.1f, h);
65 System.out.println();
66
67 }
68
69
70 }
71
72 }
73 }


View Code

好了,多多操练,加油,细姨星~

文艺不是炫耀,不是花哨空洞的文字堆砌,不是一张又一张的逆光照片,不是将旅行的意义转化为名牌包和明信片的物质展示;很多时候它甚至完全不美——它嘶吼、扭曲,它会痛苦地抽搐,它常常无言地沉默。——艾小柯《文艺是一种信仰》
分享到: