Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么这个会出现WA呢?import java.text.DecimalFormat; import java.util.Scanner; import java.util.Vector; public class Main { static final double factor1 = 0.5555; static final double factor2 = 5417.7530; static final double factor3 = 273.16; static Vector<Double> T = new Vector<Double>(); static Vector<Double> D = new Vector<Double>(); static Vector<Double> H = new Vector<Double>(); static DecimalFormat df = new DecimalFormat("###.0"); public static double calH(double T, double D) { double e = 6.11*Math.exp(factor2*((1/factor3)-(1/(D+factor3)))); double h = factor1*(e-10.0); return (T + h); } public static double calT(double D, double H) { double e = 6.11*Math.exp(factor2*((1/factor3)-(1/(D+factor3)))); double h = factor1*(e-10.0); return (H - h); } public static double calD(double T, double H) { double h = H - T; double e = h/factor1 + 10.0; double D = 1/((1/factor3)-(Math.log(e/6.11))/factor2) - factor3; return D; } public static void main(String[] args) { Scanner ss = new Scanner(System.in); char c1 = ss.next().charAt(0); while(c1 != 'E') { double num1 = ss.nextDouble(); char c2 = ss.next().charAt(0); double num2 = ss.nextDouble(); if(c1 == 'T' && c2 == 'D') { T.add(num1); D.add(num2); H.add(calH(num1, num2)); } else if(c1 == 'T' && c2 == 'H') { T.add(num1); H.add(num2); D.add(calD(num1, num2)); } else if(c1 == 'D' && c2 == 'H') { D.add(num1); H.add(num2); T.add(calT(num1, num2)); } c1 = ss.next().charAt(0); } for(int i=0; i<H.size(); i++) { System.out.println("T " + df.format(T.get(i)) + " D " + df.format(D.get(i)) + " H " + df.format(H.get(i))); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator