PAT甲级1011 World Cup Betting

模拟题。

#include 
using namespace std;
const double EPS = 1e-6;
char c[3] = {'W', 'T', 'L'};
char buy[3];
double ans = 0.65;

void read() {
    for (int i = 0; i < 3; ++i) {
        double maxo = 0.0;
        double odd;
        for (int j = 0; j < 3; ++j) {
            scanf("%lf", &odd);
            if (odd - maxo > EPS) {
                maxo = odd;
                buy[i] = c[j];
            }
        }
        ans *= maxo;
    }
}

void solve() {
    for (int i = 0; i < 3; ++i) {
        printf("%c ", buy[i]);
    }
    printf("%.2f\n", (ans-1)*2);
}

int main() {
    read();
    solve();
    return 0;
}

 

你可能感兴趣的:(PAT甲级题解)