C++语言:
01 /* 02 此题有问题 03 题目说四舍五入 实际数据却没有 04 */ 05 06 07 /* 08 +++++++++++++++++++++++++++++++++++++++ 09 author: chm 10 +++++++++++++++++++++++++++++++++++++++ 11 */ 12 13 #include <map> 14 #include <set> 15 #include <list> 16 #include <queue> 17 #include <cmath> 18 #include <stack> 19 #include <bitset> 20 #include <cstdio> 21 #include <cctype> 22 #include <string> 23 #include <vector> 24 #include <cassert> 25 #include <cstdlib> 26 #include <cstring> 27 #include <fstream> 28 #include <sstream> 29 #include <iomanip> 30 #include <iostream> 31 #include <algorithm> 32 33 using namespace std; 34 35 FILE * fin = stdin; 36 FILE * fout = stdout; 37 const int max_size = 10086; 38 #define ONLINE_JUDGE 39 int main() 40 { 41 #ifndef ONLINE_JUDGE 42 l freopen( "d: \\ in.txt" , "r" , stdin); 43 freopen( "d: \\ out.txt" , "w" , stdout); 44 #endif 45 46 float w , t , l; 47 float ans = 1.0; 48 49 for( int i = 0; i < 3; ++ i) 50 { 51 scanf( "%f%f%f" , & w , & t , & l); 52 float mx = w; 53 if( t > mx) 54 mx = t; 55 if( l > mx) 56 mx = l; 57 58 ans *= mx; 59 if( fabs( mx - w) < 1e-6) 60 printf( "W "); 61 else if( fabs( mx - t) < 1e-6) 62 printf( "T "); 63 else 64 printf( "L "); 65 } 66 ans = 2.0 *( ans * 0.65 - 1); //题目说四舍五入 实际数据却没有 67 //shoule be ans=2.0*(ans*0.65-1)+0.005; 68 printf( "%.2f \n " , ans); 69 70 #ifndef ONLINE_JUDGE 71 fclose( stdout); 72 system( "start d: \\ check.exe d: \\ out.txt d: \\ ans.txt"); 73 #endif 74 return 0; 75 }