PAT Basic Level 1046 划拳 (15 分)

题目链接:

https://pintia.cn/problem-sets/994805260223102976/problems/994805277847568384

AC代码:

#include <iostream>
#include <cstdio>

using namespace std;

int main(){
    int N;
    while(scanf("%d",&N)!=EOF){
        int H_1,D_1,H_2,D_2;
        int A_=0,B_=0;
        while(N--){
            scanf("%d%d%d%d",&H_1,&D_1,&H_2,&D_2);
            if((H_1+H_2==D_1)&&(H_1+H_2!=D_2))
                B_++;
            else if((H_1+H_2==D_2)&&(H_1+H_2!=D_1))
                A_++;
        }
        printf("%d %d",A_,B_);
    }
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41755143/article/details/86564671
今日推荐