Gym 101778I

题目链接

https://vjudge.net/problem/Gym-101778I

题意

两个队伍比赛,第一场在一队主场,第二场在二队主场,两场比赛总得分多的队伍获胜。如果一样,则在对方主场得分多的球队获胜。如果一样,则无法判断,要进行加时赛。

输入a,b,c,d,分别表示第一场一队二队得分,第二场一队二队得分。

输出获胜的队伍。一队获胜输出1,二队获胜输出2,无法判断输出-1。

思路

if-else即可。

AC代码
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<string>
#include<sstream>
#include<cctype>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<cstdlib>
#include<ctime>
using namespace std;
#define INF 0x3f3f3f3f
typedef long long ll;

int main()
{
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    int T, a, b, c, d;
    scanf("%d", &T);
    while (T--)
    {
        scanf("%d%d%d%d", &a, &b, &c, &d);
        if(a + c > b + d)
        {
            printf("1\n");
        }
        else if(a + c < b + d)
        {
            printf("2\n");
        }
        else if(c > b)
        {
            printf("1\n");
        }
        else if(c < b)
        {
            printf("2\n");
        }
        else
        {
            printf("-1\n");
        }
    }
    return 0;    
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值