-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1046.c
More file actions
42 lines (33 loc) · 1.2 KB
/
1046.c
File metadata and controls
42 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
1046 划拳 (15 分)
划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为:每人口中喊出一个数字,同时用手比划出一个数字。如果谁比划出的数字正好等于两人喊出的数字之和,谁就赢了,输家罚一杯酒。两人同赢或两人同输则继续下一轮,直到唯一的赢家出现。
下面给出甲、乙两人的划拳记录,请你统计他们最后分别喝了多少杯酒。
输入格式:
输入第一行先给出一个正整数 N(≤100),随后 N 行,每行给出一轮划拳的记录,格式为:
甲喊 甲划 乙喊 乙划
其中喊是喊出的数字,划是划出的数字,均为不超过 100 的正整数(两只手一起划)。
输出格式:
在一行中先后输出甲、乙两人喝酒的杯数,其间以一个空格分隔。
*/
//无难点
#include<stdio.h>
int main()
{
int n;
int a = 0, b = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++)
{
int a1, a2, b1, b2, result;
scanf("%d %d %d %d", &a1, &a2, &b1, &b2);
result = a1 + b1;
if(a2 != b2 && a2 == result)
b++;
else if(a2 != b2 && b2 == result)
a++;
else
continue;
}
printf("%d %d", a, b);
return 0;
}