团体程序设计天梯赛-练习集 L1-055 谁是赢家 (10分)

在这里插入图片描述

#include <iostream>
using namespace std;
int main()
{
    int a, b, num, cnt1 = 0, cnt2 = 0;
    cin >> a >> b;
    for (int i = 0; i < 3; i++)
    {
        cin >> num;
        if (num == 0)
        {       
            cnt1++;
        }
        else
        {
            cnt2++;
        }
    }
    if (a > b && cnt2 != 3)
    {
        cout << "The winner is a: " << a << " + " << cnt1;
    }
    else
    {
        cout << "The winner is b: " << b << " + " << cnt2;
    }
    return 0;
}
发布了161 篇原创文章 · 获赞 117 · 访问量 6047

猜你喜欢

转载自blog.csdn.net/qq_44458489/article/details/105233676