题意:略。按公式便好。
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
int main()
{
double one, two;
char first, second;
cout << setprecision ( 1 ) << fixed;
while ( cin >> first && first != 'E' )
{
cin >> one >> second >> two;
if ( first == 'T' || second == 'T' )
{
if ( first != 'T' )
{
swap(first,second);
swap(one,two);
}
if ( second == 'D' )
{
double h = ( 0.5555 ) * ( 6.11 * exp( 5417.7530 * ( 1 / 273.16 - 1 / ( two + 273.16 ) ) ) - 10.0 );
cout << "T " << one << " D " << two << " H " << one + h << endl;
}
else
{
double d = -273.16 - 1 / (log ( ((two - one )/ 0.5555 + 10.0) / 6.11 ) / 5417.7530 - 1 / 273.16);
cout << "T " << one << " D " << d << " H " << two << endl;
}
}
else
{
if ( first != 'H' )
{
swap(first,second);
swap(one,two);
}
double t = one - ( 0.5555 ) * ( 6.11 * exp( 5417.7530 * ( 1 / 273.16 - 1 / ( two + 273.16 ) ) ) - 10.0 );
cout << "T " << t << " D " << two << " H " << one << endl;
}
}
return 0;
}