PAT A1011 World Cup Betting (20 分) 模拟
作者:互联网
题目大意:给出三行数,每行三个数,找到每行中最大的元素和对应的下标,并按照要求输出。
没什么思想,按要求输出就好了,题目文字太多我也没耐心仔细看了。
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstring>
using namespace std;
char bet[3] = {'W', 'T', 'L'};
int main()
{
double production = 1;
for (int i = 0; i < 3; ++i)
{
double tmp, max = 0;
int maxIndex = 0;
for (int j = 0; j < 3; ++j)
{
scanf("%lf", &tmp);
if(max < tmp)
{
max = tmp;
maxIndex = j;
}
}
printf("%c ", bet[maxIndex]);
production *= max;
}
printf("%.2f", ((production * 0.65) - 1) * 2);
return 0;
}
标签:tmp,20,Cup,int,max,Betting,maxIndex,production,include 来源: https://blog.csdn.net/chch1996/article/details/100053517