题目:World Cup Betting
我的代码:
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
double profit = 1,max = -1000;
char type[3] = {'W','T','L'};
int t;
for(int i = 0;i < 3;i++){
max = -1000;
double temp;
for(int j = 0;j < 3;j++){
cin>>temp;
if(max < temp){
max = temp;
t = j;
}
}
profit *= max;
cout<<type[t]<<' ';
}
profit = (profit * 0.65 - 1) * 2;
printf("%.2lf",profit + 0.0005); //保持小数点后两位,加上0.0005----感觉这里要调,每台机子会不太一样
}
double类型、float类型机器会做截断处理,感觉怎么处理精度问题是一个很大的课题。。。