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 |
show my code#include <iostream> #include <algorithm> #include <cmath> using namespace std; int main() { char a,b; while(cin>>a,a!='E') { float T,D,H,f1,f2; cin>>f1>>b>>f2; if((a=='T' && b=='D') || (a=='D' && b=='T')) { if(a=='T') T=f1,D=f2; else T=f2,D=f1; float e=(6.11*exp(5417.7530 * ((1/273.16) - (1/(D+273.16))))); float h=0.5555*(e-10.0); H=T+h; } else if((a=='T' && b=='H') ||(a=='H' && b=='T')) { if(a=='T') T=f1,H=f2; else T=f2,H=f1; float h=H-T; float e=h/0.5555+10.0; D=(1/(-log(e/6.11)/5417.7530+(1/273.16))-273.16); } else if((a=='D' && b=='H') || (a=='H' && b=='D')) { if(a=='D') D=f1,H=f2; else D=f2,H=f1; float e=6.11*exp(5417.7530 * ((1/273.16) - (1/(D+273.16)))); float h=0.5555*(e-10.0); T=H-h; } 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