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 |
为什么总是WA?#include <cstdio> #include <cmath> using namespace std; int main() { float h; float temperature, humidex, dewpoint, e, fa, fb; char a, b; while((scanf("%c", &a) != EOF) && (a != 'E')) { scanf("%f%c%f", &fa, &b, &fb); temperature = 0; humidex = 0; dewpoint = 0; switch(a) { case 'T': temperature = fa; if(b == 'D') { dewpoint = fb; e = (6.11 * exp(5417.7530 * ((1.0 / 273.16) - (1.0 / (dewpoint + 273.16))))); h = 0.5555 * (e - 10.0); humidex = temperature + h; } else { humidex = fb; h = humidex - temperature; e = h / 0.5555 + 10.0; dewpoint = (1.0 /((1.0 / 273.16) - log(e / 6.11) / 5417.7530)) - 273.16; } break; case 'D': dewpoint = fa; if(b == 'T') { temperature = fb; e = (6.11 * exp(5417.7530 * ((1.0 / 273.16) - (1.0 / (dewpoint + 273.16))))); h = 0.5555 * (e - 10.0); humidex = temperature + h; } else { humidex = fb; e = (6.11 * exp(5417.7530 * ((1.0 / 273.16) - (1.0 / (dewpoint + 273.16))))); h = 0.5555 * (e - 10.0); temperature = humidex - h; } break; case 'H': humidex = fa; if(b == 'T') { temperature = fb; h = humidex - temperature; e = h / 0.5555 + 10.0; dewpoint = (1.0 /(1.0 / 273.16 - log(e / 6.11) / 5417.7530)) - 273.16; } else { dewpoint = fb; e = (float)(6.11 * exp(5417.7530 * ((1.0 / 273.16) - (1.0 / (dewpoint + 273.16))))); h = 0.5555 * (e - 10.0); temperature = humidex - h; } break; } printf("T %.1f D %.1f H %.1f\n", temperature, dewpoint, humidex); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator