您的位置:首页 > 其它

pat1011World Cup Betting (20)

2015-10-02 19:29 295 查看
题意分析:

(1)水题,采取边输入betting information边记录当前的best bet以及最高赔率

可能坑点:

(1)注意保留两位小数。

#include <iostream>
#include <iomanip>
#include <stdio.h>
using namespace std;

int main()
{
double odds[3];
int i=0;
double product=1,max=0;
int tag;
while(i<3)
{
cin>>odds[0]>>odds[1];
if(odds[1]>odds[0])
{
max=odds[1];
tag=1;
}
else
{
max=odds[0];
tag=0;
}
cin>>odds[2];
if(odds[2]>max)
{
max=odds[2];
tag=2;
}
if(tag==0)cout<<"W ";
else if(tag==1)cout<<"T ";
else cout<<"L ";
product*=max;
max=0;
i++;
}
cout<<setiosflags(ios::fixed)<<setprecision(2)<<(product*0.65-1)*2<<endl;
//printf("%.2f\n",(product*0.65-1)*2);
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: