我对这个题的思路是每输入一次对其进行一次比较,用自增来统计喝酒的杯数。
#include <stdio.h>
int main(void)
{
int num;
int Jcount = 0,Ycount = 0;
int AHan,AHua,BHan,BHua;
if(scanf("%d",&num));
while(num--)
{
if(scanf("%d %d %d %d",&AHan,&AHua,&BHan,&BHua));
if(AHan+BHan == AHua && AHan+BHan != BHua)
{
Ycount++;
}
if(AHan+BHan != AHua && AHan+BHan == BHua)
{
Jcount++;
}
}
printf("%d %d",Jcount,Ycount);
return 0;
}