首页
学习
活动
专区
圈层
工具
发布
30 篇文章
1
PAT (Basic Level) Practice (中文)1054 求平均值 (20 分)
2
PAT (Basic Level) Practice (中文)1051 复数乘法 (15 分)
3
PAT (Basic Level) Practice (中文)1050 螺旋矩阵 (25 分)
4
PAT (Basic Level) Practice (中文)1046 划拳 (15 分)
5
PAT (Basic Level) Practice (中文)1045 快速排序 (25 分)
6
PAT (Basic Level) Practice (中文)1047 编程团体赛 (20 分)
7
PAT (Basic Level) Practice (中文)1043 输出PATest (20 分)
8
PAT (Basic Level) Practice (中文)1042 字符统计 (20 分)
9
PAT (Basic Level) Practice (中文)1040 有几个PAT (25 分)
10
PAT (Basic Level) Practice (中文)1038 统计同成绩学生 (20 分)
11
PAT (Basic Level) Practice (中文)1036 跟奥巴马一起编程 (15 分)
12
PAT (Basic Level) Practice (中文)1034 有理数四则运算 (20 分)
13
PAT (Basic Level) Practice (中文)1032 挖掘机技术哪家强 (20 分)
14
PAT (Basic Level) Practice (中文)1031 查验身份证 (15 分)
15
PAT (Basic Level) Practice (中文)1030 完美数列 (25 分)
16
PAT (Basic Level) Practice (中文)1029 旧键盘 (20 分)
17
PAT (Basic Level) Practice (中文)1028 人口普查 (20 分)
18
PAT (Basic Level) Practice (中文)1027 打印沙漏 (20 分)
19
PAT (Basic Level) Practice (中文)1025 反转链表 (25 分)
20
PAT (Basic Level) Practice (中文)1053 住房空置率 (20 分)
21
PAT (Basic Level) Practice (中文)1024 科学计数法 (20 分)
22
PAT (Basic Level) Practice (中文)1022 D进制的A+B (20 分)
23
PAT (Basic Level) Practice (中文)1049 数列的片段和 (20 分)
24
PAT (Basic Level) Practice (中文)1021 个位数统计 (15 分)
25
PAT (Basic Level) Practice (中文)1048 数字加密 (20 分)
26
PAT (Basic Level) Practice (中文)1019 数字黑洞 (20 分)
27
PAT (Basic Level) Practice (中文)1017 A除以B (20 分)
28
PAT (Basic Level) Practice (中文)1016 部分A+B (15 分)
29
PAT (Basic Level) Practice (中文)1015 德才论 (25 分)
30
PAT (Basic Level) Practice (中文)1014 福尔摩斯的约会 (20 分)

PAT (Basic Level) Practice (中文)1046 划拳 (15 分)

1046 划拳 (15 分)

划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为:每人口中喊出一个数字,同时用手比划出一个数字。如果谁比划出的数字正好等于两人喊出的数字之和,谁就赢了,输家罚一杯酒。两人同赢或两人同输则继续下一轮,直到唯一的赢家出现。

下面给出甲、乙两人的划拳记录,请你统计他们最后分别喝了多少杯酒。

输入格式:

输入第一行先给出一个正整数 N(≤100),随后 N 行,每行给出一轮划拳的记录,格式为:

代码语言:javascript
复制
甲喊 甲划 乙喊 乙划

其中是喊出的数字,是划出的数字,均为不超过 100 的正整数(两只手一起划)。

输出格式:

在一行中先后输出甲、乙两人喝酒的杯数,其间以一个空格分隔。

输入样例:

代码语言:javascript
复制
5
8 10 9 12
5 10 5 10
3 8 5 12
12 18 1 13
4 16 12 15

输出样例:

代码语言:javascript
复制
1 2

老模拟题了,15分水题~

代码语言:javascript
复制
// luogu-judger-enable-o2
#include<bits/stdc++.h>
#include<unordered_set>
#define rg register ll
#define inf 2147483647
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
#define ll long long
#define maxn 300005
#define lb(x) (x&(-x))
const double eps = 1e-6;
using namespace std;
inline ll read()
{
	char ch = getchar(); ll s = 0, w = 1;
	while (ch < 48 || ch>57) { if (ch == '-')w = -1; ch = getchar(); }
	while (ch >= 48 && ch <= 57) { s = (s << 1) + (s << 3) + (ch ^ 48); ch = getchar(); }
	return s * w;
}
inline void write(ll x)
{
	if (x < 0)putchar('-'), x = -x;
	if (x > 9)write(x / 10);
	putchar(x % 10 + 48);
}
ll n,sum1,sum2;
int main()
{
    n=read();
    for(rg i=1;i<=n;i++)
    {
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        if(b==a+c&&d!=a+c)sum2++;
        if(d==a+c&&b!=a+c)sum1++;
    }
    cout<<sum1<<" "<<sum2<<endl;
   	return 0;
}
下一篇
举报
领券