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

四舍五入了,却WA了,明明要求四舍五入的。

Posted by jiangwuqwe at 2010-05-17 11:54:44 on Problem 3299
#include <stdio.h>
//#include <string.h>
//#include <windows.h>
#include <math.h>
int main()
{
	double T,D,H,h,e;
	char ch1,ch2;
	double d1,d2;
	//long start = GetTickCount();
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	while(scanf("%c%*c",&ch1))
	{
        if(ch1 == 'E')break;
		T=D=H=0.0;
		scanf("%lf%*c%c%*c%lf%*c",&d1,&ch2,&d2);
		switch(ch1)
		{
		case 'T':T=d1;break;
		case 'D':D=d1;break;
		case 'H':H=d1;break;
		}
		switch(ch2)
		{
		case 'T':T=d2;break;
		case 'D':D=d2;break;
		case 'H':H=d2;break;
		}
		switch(ch1+ch2)
		{
		case 'T'+'D':
			e = 6.11*exp(5417.7530 * ((1.0/273.16) - (1.0/(D+273.16))));
			h = (0.5555)*(e-10.0);
			H = T+h;
			// H = T+h+0.05;
			break;
		case 'D'+'H':
			e = 6.11*exp(5417.7530 * ((1.0/273.16) - (1.0/(D+273.16))));
			h = (0.5555)*(e-10.0);
			T = H-h;
			//T = H-h+0.05;
			break;
		case 'H'+'T':
			h = H-T;
			e = h/0.5555 + 10.0;
			D = 1.0/((1.0/273.16) - (log(e/6.11))/5417.7530) - 273.16 ;
			//D += 0.05;
			break;
		}
		printf("T %0.1f D %0.1f H %0.1f\n",T,D,H);
	}

	//printf("%d ms\n",GetTickCount()-start);
	return 0;
}
// H = T + h
// h = (0.5555)× (e - 10.0)
// e = 6.11 × exp [5417.7530 × ((1/273.16) - (1/(D+273.16)))]

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