PAT B1046.猜拳

课本AC

#include <cstdio>
int main() {
    int n, failA = 0, failB = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        int a1, a2, b1, b2;
        scanf("%d%d%d%d", &a1, &a2, &b1, &b2);
        if(a1 + b1 = a2 && a1 + b1 != b2) {
            failB++;
        } else if(a1 + b1 = b2 && a1 + b1 != a2) {
            failA++;
        }
    }
    printf("%d %d\n", failA, failB);
    return 0;
}

自己解的部分AC,搞不清楚哪里出错了

#include <cstdio>

int main() {
    int jyin = 0, yyin = 0;
    int time;
    scanf("%d", &time);
    while(time > 0) {
        int jhua, jhan, yhua, yhan;
        scanf("%d%d%d%d", &jhan, &jhua, &yhan, &yhua);
        sum = jhan + yhan;
        if(sum == jhua && sum != yhua) jyin++;
        else if(sum == yhua && sum != jhua) yyin++;
    }
    printf("%d %d", jyin, yyin);
    return 0;
}
posted @ 2019-07-14 21:45  哨音  阅读(194)  评论(0编辑  收藏  举报