随笔分类 -  PAT (Basic Level) Practice

1044 火星数字 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { // 十三进制 string low[13]{"tret", "jan", "feb", "mar", "apr", "may", "jun", "jly", "aug", "sep 阅读全文

posted @ 2021-08-31 22:01 Atl212 阅读(77) 评论(0) 推荐(0)

1041 考试座位号 (15 point(s))
摘要:#include <bits/stdc++.h> using namespace std; struct Stu{ long long id; int num; }; int main() { int n, m; map<int ,Stu> stu; // 读取考生人数 cin >> n; // 读 阅读全文

posted @ 2021-08-31 19:23 Atl212 阅读(49) 评论(0) 推荐(0)

1043 输出PATest (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { // 英文字符串 重置顺序(固定格式 删去其他字符 // 区分大小写 string str; cin >> str; int P = 0, A = 0, T = 0, e = 0, 阅读全文

posted @ 2021-08-31 16:26 Atl212 阅读(48) 评论(0) 推荐(0)

1042 字符统计 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { // 找出出现最多字母 不包括乱七八糟的符号 map<char, int> alpha; string str; // 整行读取字符串 getline(cin, str); // 统 阅读全文

posted @ 2021-08-31 16:01 Atl212 阅读(52) 评论(0) 推荐(0)

1040 有几个PAT (25 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; int cnt[2][str.size()]{0}, P = 0, T = 0, sum = 0; // 正序统计 P 字符个数 fo 阅读全文

posted @ 2021-08-31 15:10 Atl212 阅读(31) 评论(0) 推荐(0)

1039 到底买不买 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { // 包含全部需要珠子 剩余 或缺少 // 跟旧键盘的思路类似 一个预定的输入 一实际输出 map<char, int> store, red; string s, r; // 读取 阅读全文

posted @ 2021-08-31 12:14 Atl212 阅读(40) 评论(0) 推荐(0)

1038 统计同成绩学生 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n, k, t; map<int, int> stu; cin >> n; while(n--){ cin >> t; stu[t]++; } cin >> k; for(i 阅读全文

posted @ 2021-08-31 10:45 Atl212 阅读(36) 评论(0) 推荐(0)

1036 跟奥巴马一起编程 (15 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n; char c; // 读取边长n 和字符c cin >> n >> c; // 行数是列数的一半 (四舍五入 int line = (n & 1 ? n / 2 + 1 阅读全文

posted @ 2021-08-31 09:33 Atl212 阅读(38) 评论(0) 推荐(0)

1037 在霍格沃茨找零钱 (20 point(s))
摘要:// 未简化前代码 #include <bits/stdc++.h> using namespace std; int main() { int P[3], A[3], result[3], p, a; char c; cin >> P[2] >> c >> P[1] >> c >> P[0]; c 阅读全文

posted @ 2021-08-31 09:16 Atl212 阅读(42) 评论(0) 推荐(0)

1035 插入与归并 (25 point(s))
摘要:判断是插入还是归并函数。题目所说“保证每组测试的结果是唯一的”,所以判断其中一个即可。而判断插入函数,由于插入排序必然使得 所以插入排序满足前面的元素有序,而后面的元素待排元素与原始序列相等。所以由以下代码来判断。 a[j] == b[j] if(j == n) 当后面待排元素和原始序列都满足相等的 阅读全文

posted @ 2021-08-30 15:05 Atl212 阅读(133) 评论(0) 推荐(0)

1034 有理数四则运算 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; typedef long long ll; // 最大公约数 int gcd(ll a, ll b){ return b ? gcd(b, a % b) : a; } void print(ll a, ll 阅读全文

posted @ 2021-08-27 19:53 Atl212 阅读(50) 评论(0) 推荐(0)

PAT (Basic Level) 1033 旧键盘打字 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { string bad, good; getline(cin, bad); getline(cin, good); for(int i = 0; i < good.size(); i+ 阅读全文

posted @ 2021-08-25 22:56 Atl212 阅读(43) 评论(0) 推荐(0)

PAT (Basic Level) 1032 挖掘机技术哪家强 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int, int> school; for(int i = 0; i < n; i++) { int num, score; cin >> 阅读全文

posted @ 2021-08-25 21:39 Atl212 阅读(35) 评论(0) 推荐(0)

PAT (Basic Level) 1031 查验身份证 (15 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n, allPassed = true, weight[17]{7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2}; c 阅读全文

posted @ 2021-08-25 21:14 Atl212 阅读(52) 评论(0) 推荐(0)

导航