pat-B1046- Guessing Game

Description Title -> Link

Thinking

  1. According to the meaning of the questions you can, lose judgment with the same attention to win.

Code

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>

using namespace std;

int main(){
    int jia1,jia2,yi1,yi2,n;
    scanf("%d",&n);
    int jiahe=0,yihe=0;
    for(int i=0;i<n;i++){
        scanf("%d%d%d%d",&jia1,&jia2,&yi1,&yi2);
        if((jia1+yi1==jia2)&&(jia1+yi1!=yi2))  yihe++;
        else if((jia1+yi1==yi2)&&(jia1+yi1!=jia2))  jiahe++;
        else continue;
    }
    printf("%d %d\n",jiahe,yihe);
}

Released eight original articles · won praise 1 · views 109

Guess you like

Origin blog.csdn.net/MichealWu98/article/details/104010322