标签:style blog color io os ar div sp log
公式题中已经给出,直接求解即可。
1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <cstring> 6 #include <cmath> 7 #include <cctype> 8 #include <algorithm> 9 #include <numeric> 10 #include <sstream> 11 #include <map> 12 #include <iomanip> 13 using namespace std; 14 15 map<char, double> data; 16 17 int main () { 18 ios :: sync_with_stdio (false); 19 char C1, C2; 20 double X1, X2; 21 while (cin >> C1) { 22 if (C1 == ‘E‘) break; 23 cin >> X1 >> C2 >> X2; 24 data[C1] = X1; data[C2] = X2; 25 if ( (C1 == ‘T‘ && C2 == ‘H‘) || (C1 == ‘H‘ && C2 == ‘T‘) ) { 26 double h = data[‘H‘] - data[‘T‘]; 27 double e = h / 0.5555 + 10.0; 28 double ln_ = log (e / 6.11); 29 data[‘D‘] = 1.0 / (1.0 / 273.16 - ln_ / 5417.7536) - 273.16; 30 } 31 else { 32 33 double e = 6.11 * exp (5417.7530 * (1.0 / 273.16 - (1.0 / (data[‘D‘] + 273.16)))); 34 //cout << "e = " << e << endl; 35 double h = (0.5555) * (e - 10.0); 36 //cout << "h = " << h << endl; 37 if ((C1 == ‘T‘ && C2 == ‘D‘ ) || (C1 == ‘D‘ && C2 == ‘T‘)) { 38 //cout << "T D -> H" << endl; 39 data[‘H‘] = data[‘T‘] + h; 40 } 41 if ((C1 == ‘H‘ && C2 == ‘D‘ ) || (C1 == ‘D‘ && C2 == ‘H‘)) { 42 //cout << "H D -> T" << endl; 43 data[‘T‘] = data[‘H‘] - h; 44 } 45 } 46 printf ("T %.1f D %.1f H %.1f\n", data[‘T‘], data[‘D‘], data[‘H‘]); 47 } 48 return 0; 49 }
标签:style blog color io os ar div sp log
原文地址:http://www.cnblogs.com/Destiny-Gem/p/3979095.html