L1-055 誰是贏家 分數 10

Frodnx發表於2024-08-06
// 7'18"
#include <iostream>
using namespace std;

int main()
{
    int pa, pb;
    cin >> pa >> pb;
    int p1, p2, p3;
    cin >> p1 >> p2 >> p3;
    
    bool awin = false;
    if(p1 + p2 + p3 == 0) awin = true;
    else if(p1 + p2 + p3 == 3) awin = false;
    else if(p1 + p2 + p3 != 0 && pb > pa) awin = false;
    else if(p1 + p2 + p3 != 3 && pa > pb) awin = true;
    if(awin)
        cout << "The winner is a: " << pa << " + " << 3 - (p1 + p2 + p3);
    else 
        cout << "The winner is b: " << pb << " + " << p1 + p2 + p3;
    return 0;
}

相關文章