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

我的AC代码在GCC下锅不过,WA了四次,很是心痛.

Posted by pcptest at 2015-09-08 07:10:59 on Problem 3299
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

double exponent=2.718281828; 

double calcT(double D, double H)
{
	double e=6.11*exp(5417.7530*((1/273.16)-(1/(D+273.16))));
	double h=(0.5555)*(e - 10.0);
	double T=H-h;
	
	return T;
}

double calcD(double T, double H)
{
	double h=H-T;
	double e=10.0+h/0.5555;
	double D=1/((1/273.16)-(log(e/6.11))/5417.7530)-273.16;
	
	return D;
}

double calcH(double T, double D)
{
	double e=6.11*exp(5417.7530*((1/273.16)-(1/(D+273.16))));
	double h=0.5555*(e-10.0);
	double H=T+h;
	
	return H;
}


int main(int argc, char *argv[]) {
	char first_char, second_char;
	double first_num, second_num;
	double T, D, H;
	for(;;)
	{
		scanf("%c", &first_char);
		if(first_char=='E')
		{
			break;
		}
		scanf("%lf %c %lf", &first_num, &second_char, &second_num);
		if(first_char=='T' && second_char=='D')
		{
			H = calcH(first_num, second_num);
			printf("T %.1lf D %.1lf H %.1lf\n", first_num, second_num, H);
		}
		else if(first_char=='D' && second_char=='T')
		{
			H = calcH(second_num, first_num);
			printf("T %.1lf D %.1lf H %.1lf\n", second_num, first_num, H);
		}
		else if(first_char=='T' && second_char=='H')
		{
			D = calcD(first_num, second_num);
			printf("T %.1lf D %.1lf H %.1lf\n", first_num, D, second_num);
		}
		else if(first_char=='H' && second_char=='T')
		{
			D = calcD(second_num, first_num);
			printf("T %.1lf D %.1lf H %.1lf\n", second_num, D, first_num);
		}
		else if(first_char=='D' && second_char=='H')
		{
			T = calcT(first_num, second_num);
			printf("T %.1lf D %.1lf H %.1lf\n", T, first_num, second_num);
		}
		else if(first_char=='H' && second_char=='D')
		{
			T = calcT(second_num, first_num);
			printf("T %.1lf D %.1lf H %.1lf\n", T, second_num, first_num);
		}
	}
	
	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