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 |
额,试了好几个编译器都能过的代码.这个题是知道2个根据公式求第三个,,刚开始做以为是告诉你T和D求H.. 送了无数的WA 下面代码 #include <stdio.h> #include <math.h> int main() { float t,d,h; char c1, c2; float x, y; while(scanf ( " %c", &c1 ) , c1 != 'E') { scanf ( "%f %c%f", &x, &c2, &y ); t = d = h = 0; if(c1=='T') t = x; else if(c1=='D') d = x; else if(c1=='H') h = x; if(c2=='T') t = y; else if(c2=='D') d = y; else if(c2=='H') h = y; if(t==0) { t = h - 0.5555*(6.11*exp(5417.7530*(1/273.16-(1/(d+273.16))))-10.0); } if(d==0) { d = (h-t)/0.5555+10.0; d = d/6.11; d = log(d); d = d/5417.7530; d = 1/273.16 - d; d = 1/d-273.16; } if(h==0) { h = t + 0.5555*(6.11*exp(5417.7530*(1/273.16-(1/(d+273.16))))-10.0); } printf ( "T %.1f D %.1f H %.1f\n", t, d, h ); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator