- 博客(89)
- 收藏
- 关注
原创 PAT (Basic Level) 1095 解码PAT准考证
题意又是成绩统计,自己读题吧,题目太长了。思路或许basic最难(烦)的题目。询问1,3要预排序,要不然筛完再排序会T。代码#include <bits/stdc++.h>using namespace std;struct node { string s; int sc; char lv; int tid, t, sid; node() {} node(st...
2020-03-03 22:20:35
232
原创 PAT (Basic Level) 1094 谷歌的招聘
题意判长度为K的子串里是否有素数。思路模呗。注意输出的时候补0。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, k; cin >> n ...
2020-03-03 22:16:32
249
原创 PAT (Basic Level) 1093 字符串A+B
题意字符串A+B,剔除重复字符。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); string a; string b; vector<bool&g...
2020-03-03 22:09:05
211
原创 PAT (Basic Level) 1092 最好吃的月饼
题意找出月饼销量冠军。思路水~代码#include <bits/stdc++.h>using namespace std;struct cake { double num, val;};int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, m...
2020-03-03 22:07:22
174
原创 PAT (Basic Level) 1091 N-自守数
题意自行读题吧。。。思路暴力。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; for (int i = 0, x;...
2020-03-03 22:04:39
112
原创 PAT (Basic Level) 1090 危险品装箱
题意给若干个危险配对,若干组询问,问这一组是否安全。思路map搞搞呗。代码#include <bits/stdc++.h>using namespace std;struct cake { double num, val;};int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie...
2020-03-03 22:02:21
205
原创 PAT (Basic Level) 1089 狼人杀-简单版
题意判断哪两个人是狼。思路假设两只狼,进行校验。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; ...
2020-03-03 21:59:35
263
原创 PAT (Basic Level) 1088 三人行
题意推算三个人成绩,判断从不从。思路注意double也是可以的。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int m, x, y; cin >>...
2020-03-03 21:48:28
133
原创 PAT (Basic Level) 1087 有多少不同的值
题意set裸题。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; set<int> s; fo...
2020-03-03 21:45:37
170
1
原创 PAT (Basic Level) 1086 就不告诉你
题意倒着输出A * B,去除前导0。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int a, b; cin >> a >> b...
2020-03-03 21:42:41
151
原创 PAT (Basic Level) 1085 PAT单位排行
题意给定一些成绩,给单位做排行。思路转个小写,用用map,排排序,整整排名,谁不会呢?代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >...
2020-03-03 21:35:36
1462
原创 PAT (Basic Level) 1084 外观数列
题意自己读题吧。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); string d; int n; cin >> d >> n;...
2020-03-03 21:32:17
157
原创 PAT (Basic Level) 1083 是否存在相等的差
题意求相等的差和其次数。思路map随便搞搞呗。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; m...
2020-03-03 21:29:48
189
原创 PAT (Basic Level) 1081 检查密码
题意按要求校验密码。思路模拟即可。要使用getline。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; cin.i...
2020-03-03 21:27:11
144
原创 PAT (Basic Level) 1080 MOOC期终成绩
题意emm,又是算分数。思路模拟即可。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int p, m, n; cin >> p >> m...
2020-03-03 21:20:29
180
原创 PAT (Basic Level) 1079 延迟的回文数
题意数字串+反转数字串得到新数字串为一次操作,问能不能在10次以内找到回文串。思路大数加法,注意初始串就要判一次是不是回文串。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullpt...
2020-03-03 21:15:51
141
原创 PAT (Basic Level) 1078 字符串压缩与解压
题意字符串压缩与解压缩。思路模拟即可。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); char c; cin >> c; cin.ignore(1)...
2020-03-03 21:11:32
146
原创 PAT (Basic Level) 1077 互评成绩计算
题意去掉一个最高分和一个最低分,剩下的分数取平均分记为G1;老师给这个组的评分记为G2。该组得分为(G1+G2)/2,最后结果四舍五入后保留整数分。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nul...
2020-03-03 21:09:22
136
原创 PAT (Basic Level) 1076 Wifi密码
题意按正确答案组成wifi密码。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; for (int i = ...
2020-03-03 21:05:21
179
原创 PAT (Basic Level) 1075 链表元素分类
题意给一个链表,按数据重新分断。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); string start; int n, k; cin >>...
2020-03-03 19:35:59
160
原创 PAT (Basic Level) 1074 宇宙无敌加法器
题意进制转换题,不过每一位进制都不同。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); string jz, a, b; cin >> jz &...
2020-03-03 19:32:05
118
原创 PAT (Basic Level) 1073 多选题常见计分法
题意又是选择题,同 PAT (Basic Level) 1058 选择题 。多了一个部分分。思路注意读入的问题,善用位运算。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr...
2020-03-03 19:28:12
133
原创 PAT (Basic Level) 1071 小赌怡情
题意模拟赌博,233。。。思路条件判清楚就行了。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int T, k; cin >> T >>...
2020-03-03 19:24:30
159
原创 PAT (Basic Level) 1070 结绳
题意给定一段一段的绳子,你需要把它们串成一条绳。每次串连的时候,是把两段绳子对折,再如下图所示套接在一起。这样得到的绳子又被当成是另一段绳子,可以再次对折去跟另一段绳子串连。每次串连后,原来两段绳子的长度就会减半。给定 N 段绳子的长度,你需要找出它们能串成的绳子的最大长度。思路贪心,从小的开始连。注意最后要取整。代码#include <bits/stdc++.h>usi...
2020-03-03 19:22:13
149
原创 PAT (Basic Level) 1069 微博转发抽奖
题意又是一道题意模糊的题。到底是中过奖了就不算人头了,还是中过奖再抽到才不算人头呢?好像两个都行,不太清楚。我选的前者理解。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nul...
2020-03-03 19:19:38
121
原创 PAT (Basic Level) 1068 万绿丛中一点红
题意无语了,我读了N遍题都没读懂题目,代码敲了N遍。。。直接看代码吧。思路。。。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, m, lo; cin...
2020-03-03 19:12:39
166
原创 PAT (Basic Level) 1067 试密码
题意试密码,按要求输出。思路读入稍微注意一下,水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); string right; int n; cin >&g...
2020-03-03 19:09:45
149
原创 PAT (Basic Level) 1066 图像过滤
题意给定一个像素矩阵,将指定区间的像素点置换,求生成结果。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, m; cin >> n...
2020-03-03 19:07:11
125
原创 PAT (Basic Level) 1065 单身狗
题意给定若干对情侣,问一场聚会上有多少没有情侣的人。思路map随便搞搞。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n...
2020-03-03 19:03:55
167
原创 PAT (Basic Level) 1064 朋友数
题意如果两个整数各位数字的和是一样的,则被称为是“朋友数”,而那个公共的和就是它们的“朋友证号”。例如 123 和 51 就是朋友数,因为 1+2+3 = 5+1 = 6,而 6 就是它们的朋友证号。给定一些整数,要求你统计一下它们中有多少个不同的朋友证号。思路水~代码#include <bits/stdc++.h>using namespace std;int main...
2020-03-03 19:01:19
122
原创 PAT (Basic Level) 1063 计算谱半径
题意计算谱半径。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; double ans = 0; for...
2020-03-03 18:58:09
136
原创 PAT (Basic Level) 1062 最简分数
题意求两个分数之间的、最简的且分母为K的分数。思路先进行通分,判断之间的所有分数化为最简分数后分母是不是K。坑点:注意不能直接暴力地+1+1判过去,这样会T。给定的两个分数可能后面小,前面大。答案不包含两端点。代码#include <bits/stdc++.h>using namespace std;int main() { //ios::sync_with...
2020-03-03 18:55:47
169
原创 PAT (Basic Level) 1061 判断题
题意判断题计分。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, m; cin >> n >> m; vector&...
2020-03-03 18:45:48
124
原创 PAT (Basic Level) 1060 爱丁顿数
题意“爱丁顿数” E ,即满足有 E 天骑车超过 E 英里的最大整数 E。现给定某人 N 天的骑车距离,请你算出对应的爱丁顿数 E。思路大于N的数字直接当N + 1就好了。直接上树状数组就好了。其实sort一下直接做确实更简便,两种写法都在下面给出。代码#include <bits/stdc++.h>using namespace std;struct BIT { v...
2020-03-03 00:53:18
135
原创 PAT (Basic Level) 1059 C语言竞赛
题意排个序,按要求发个奖品。思路排排名次,判判素数,打打标记,就过嘞。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n...
2020-03-03 00:44:56
134
原创 PAT (Basic Level) 1058 选择题
题意让你帮忙批改选择题。思路做好读入,熟悉位运算,快乐的AC。好吧,读入确实很难做,可以康康我这cin下的输入怎么做的,相信你会学有所获。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(...
2020-03-03 00:41:23
144
原创 PAT (Basic Level) 1057 数零壹
题意给定符号串,所有字母不论大小写,按1-26计贡献,求其和的二进制表示下有几个0。思路水~代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); string s; g...
2020-03-03 00:37:45
150
原创 PAT (Basic Level) 1056 组合数的和
题意n个个位数,求所有组合的两位数之和。不同位置的相同数字其本质不同。思路每个数a[i]个位出现n-1次,十位也是。所以贡献为a[i] * (n - 1) * 11。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullpt...
2020-03-03 00:28:34
103
原创 PAT (Basic Level) 1055 集体照
题意学生按身高排序,按要求排方阵。思路deque是个好东西。代码#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n, k; cin >> n &g...
2020-03-03 00:23:55
136
原创 PAT (Basic Level) 1054 求平均值
题意给一个数组,求合法数据平均值。思路在不知道stof的情况下模了不少时间,踩了超级多坑(依稀记得999.这种也是合法数字),这里给出两份代码。一份是强行模拟的初版,另一份是使用stof的。自行参考。代码初版:#include <bits/stdc++.h>using namespace std;int main() { ios::sync_with_stdio(fa...
2020-03-03 00:16:05
177
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅