PAT 1046

/**

划拳 题目关于数字的定义反了
PAT 1046
*/
#include <iostream>
using namespace std;
int cal(int a,int b,int c,int d)
{
if(a+c==b&&a+c!=d) return 1; //甲赢输出1

if(a+c==d&&a+c!=b) return -1; //乙赢输出-1

else return 0; //不输不赢输出0
}

int main()
{
int input;
cin>>input;

int x,y,m,n; // x:甲划拳数 y:甲喊出的数字 m:乙划拳数 n:乙喊出的数字

int flag=0,temp=0; //flag为甲赢的次数,temp为乙赢的次数

for(int i=0;i<input;++i)
{
cin>>x>>y>>m>>n;
int t=cal(x,y,m,n);
if(t1) flag++;
if(t
-1) temp++;
}

//甲赢的次数对应于乙喝酒次数,所以输出反过来

cout<<temp<<" "<<flag<<endl;
return 0;
}

posted @ 2020-07-18 19:52  云墨丹心  阅读(104)  评论(0)    收藏  举报