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 |
给个c++和g++都能过的代码。。。用iostream用cstdio时输入输出混乱了……虽然iostream效率略低,这题没啥问题 #include <iostream> #include <iomanip> #include <cmath> using namespace std; char c; double t,d,h; bool tt,dd,hh; int main() { cout<<setprecision(1)<<fixed; while (true) { tt=dd=hh=true; cin>>c; if (c=='E') break; switch (c) { case 'T':tt=false;cin>>t;break; case 'H':hh=false;cin>>h;break; case 'D':dd=false;cin>>d;break; } cin>>c; switch (c) { case 'T':tt=false;cin>>t;break; case 'H':hh=false;cin>>h;break; case 'D':dd=false;cin>>d;break; } if (tt) { t=h-0.5555*(6.11*exp(5417.7530*((1/273.16)-(1/(d+273.16))))-10.0); } else if (dd) { d=1/(1/273.16-log(((h-t)/0.5555+10)/6.11)/5417.7530)-273.16; } else { h=t+0.5555*(6.11*exp(5417.7530*((1/273.16)-(1/(d+273.16))))-10.0); } cout<<"T "<<t<<" D "<<d<<" H "<<h<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator