上一页 1 ··· 6 7 8 9 10 11 下一页

2021年8月31日

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 阅读(50) 评论(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 阅读(30) 评论(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 阅读(36) 评论(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 阅读(32) 评论(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 阅读(34) 评论(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 阅读(37) 评论(0) 推荐(0)

2021年8月30日

1035 插入与归并 (25 point(s))

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

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

2021年8月27日

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 阅读(47) 评论(0) 推荐(0)

2021年8月25日

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 阅读(37) 评论(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 阅读(29) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10 11 下一页

导航