您的位置:首页 > 其它

[PAT]1011. World Cup Betting (20)

2016-08-06 00:46 513 查看
#include<iostream>
using namespace std;

int main()
{
double profit=1;
char dict[3]={'W','T','L'};
char ans[3];
double input[3];
int kk=0;
while(scanf("%lf%lf%lf",&input[0],&input[1],&input[2])!=EOF)
{
kk=kk+1;
double tmp=0;
int n=0;
for(int m=0;m<3;m++)
{
if(tmp<input[m])
{
tmp=input[m];
n=m;
}
}
profit=profit*tmp;
ans[(kk-1)%3]=dict
;
if(kk%3==0)
{
profit=(profit*0.65-1)*2;
for(int k=0;k<3;k++)
{
cout<<ans[k]<<" ";
}
printf("%.2lf\n",profit);//这里有个问题
profit=1;
}
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: