Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

show my code

Posted by 20083331 at 2009-05-30 09:49:42 on Problem 3299
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator