题目链接:PAT【甲级】1011
题目简述:相当于给定三组数字,选取每一组中最大的,按照一定的公式计算出结果。
#include<bits/stdc++.h>
using namespace std;
int main(){
double x, y, z;
string ans_s = "";
double ans = 1;
for (int i = 0; i < 3;i++){
cin >> x >> y >> z;
double t = max(x, max(y, z));
ans *= t;
t == x ? ans_s += "W" : (t == y ? ans_s += "T" : ans_s += "L");
}
cout << ans_s[0] << " " << ans_s[1] << " " << ans_s[2] << " ";
printf("%.2f", (ans * 0.65 - 1) * 2);
return 0;
}
这道题目收到的启发是:跳过无用信息,直接看与题目输入数据相关的信息,截个输入输出猜意思。