PAT甲级1011

#include<iostream>
using namespace std;

struct game
{
    float odd[3];
};

int main()
{
    float max1;
    game g[3];
    float w, t, l;
    for (int i = 0; i < 3; ++i)
    {
        cin >> w >> t >> l;
        g[i] = {w, t, l};
    }

    float maxo[3] = {0.0};

    maxo[0] = max(g[0].odd[0], g[0].odd[1]);
    maxo[0] = max(maxo[0], g[0].odd[2]);

    maxo[1] = max(g[1].odd[0], g[1].odd[1]);
    maxo[1] = max(maxo[1], g[1].odd[2]);

    maxo[2] = max(g[2].odd[0], g[2].odd[1]);
    maxo[2] = max(maxo[2], g[2].odd[2]);

    char M[3] = {'W', 'T', 'L'};
    for (int j = 0; j < 3; ++j)
    {
        for (int i = 0; i < 3; ++i)
        {
            if (g[j].odd[i] == maxo[j])
            cout << M[i] << " ";
        }
    }

    float profit;
    profit = (maxo[0] * maxo[1] * maxo[2] *0.65 - 1) * 2;
    printf("%.2f", profit);
}

猜你喜欢

转载自blog.csdn.net/NULLdream/article/details/81582572
今日推荐