随笔分类 -  PAT (Basic Level) Practice

1009 说反话 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { string str, tmp1 = "", tmp2; vector<string> v; getline(cin, str); for(auto s: str) { // 当字符 阅读全文

posted @ 2021-09-05 21:56 Atl212 阅读(32) 评论(0) 推荐(0)

1007 素数对猜想 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; bool prime(int p){ // 如果是平方要取等号 for(int i = 2; i <= sqrt(p); i++){ if(p % i == 0) return false; } return 阅读全文

posted @ 2021-09-05 21:44 Atl212 阅读(60) 评论(0) 推荐(0)

1006 换个格式输出整数 (15 point(s))
摘要:// Time Limit Exceeded 13分 #include <bits/stdc++.h> using namespace std; int main(){ int a[3]; string str; cin >> str; // 记录有多少位 int byte = str.size() 阅读全文

posted @ 2021-09-05 17:36 Atl212 阅读(37) 评论(0) 推荐(0)

1003 我要通过! (20 point(s))
摘要:// 15point 乱来写乱来凑输出 // 虽然能够通过样例,但实际连题目给出的条件都没有全覆盖 #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while(n--){ string str; 阅读全文

posted @ 2021-09-05 17:21 Atl212 阅读(54) 评论(0) 推荐(0)

1002 写出这个数 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { int sum = 0; stack<int> s; string str, pingyin[10]{"ling", "yi", "er", "san", "si", "wu", " 阅读全文

posted @ 2021-09-04 19:23 Atl212 阅读(35) 评论(0) 推荐(0)

1004 成绩排名 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; struct Stu{ string name, id; }; int main() { int n, max = 0, min = 100; map<int, Stu> stu; cin >> n; whi 阅读全文

posted @ 2021-09-04 12:02 Atl212 阅读(38) 评论(0) 推荐(0)

1058 选择题 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; struct Question{ int score, num, cor; set<char> copt; }; int main() { // 批改选择题 指出错误人数最多题目 // 输入 学生人数 多选题 阅读全文

posted @ 2021-09-04 11:49 Atl212 阅读(57) 评论(0) 推荐(0)

1057 数零壹 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { // 数N表示成二进制的1 0 个数 int zero = 0, one = 0, N = 0; string str; // 可能有空格 getline(cin, str); // 阅读全文

posted @ 2021-09-03 17:12 Atl212 阅读(37) 评论(0) 推荐(0)

1056 组合数的和 (15 point(s))
摘要:// 不想思考暴力法 #include <bits/stdc++.h> using namespace std; int main() { // N 非零个位 任意两个组合成二位数字 // 求所有可能组合数之和 int n, sum = 0, a[10]; cin >> n; for(int i = 阅读全文

posted @ 2021-09-03 16:00 Atl212 阅读(61) 评论(0) 推荐(0)

1055 集体照 (25 point(s))
摘要:// 未精简全AC代码 // Bob175 Tom 188 Joe 190 Nick186 // Ann168 Mike170 Eva 168 // Tim160 Amy 160 John159 #include <bits/stdc++.h> using namespace std; struct 阅读全文

posted @ 2021-09-03 12:39 Atl212 阅读(58) 评论(0) 推荐(0)

1054 求平均值 (20 point(s))
摘要:// 正确代码 #include <bits/stdc++.h> using namespace std; int main() { // N个实数 剔除非法数据 求平均值 int n, legal = 0; double result = 0, num = 0; cin >> n; while(n 阅读全文

posted @ 2021-09-03 09:54 Atl212 阅读(72) 评论(0) 推荐(0)

1053 住房空置率 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { // 空置率 用电量 连续 变化规律 // 读取 住房套数 低电量阈值 观察期阈值 double e; int n, D, pos = 0, space = 0; cin >> n 阅读全文

posted @ 2021-09-02 21:39 Atl212 阅读(36) 评论(0) 推荐(0)

1052 卖个萌 (20 point(s))
摘要:// 未精简代码 #include <bits/stdc++.h> using namespace std; int main() { // 给出符号集合 按要求输出 // []内为符号 每个集合至少一个符号 ? 左手 // 集合不超过10 个 符号不超过4个字符 string h, e, m, t 阅读全文

posted @ 2021-09-02 20:46 Atl212 阅读(50) 评论(0) 推荐(0)

1051 复数乘法 (15 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { double R1, P1, R2, P2, A, B; cin >> R1 >> P1 >> R2 >> P2; A = R1 * R2 * (cos(P1) * cos(P2) 阅读全文

posted @ 2021-09-02 15:57 Atl212 阅读(48) 评论(0) 推荐(0)

1050 螺旋矩阵 (25 point(s))(未AC错误代码,仅错误思路记录)
摘要:#include <bits/stdc++.h> using namespace std; int main() { int N, m, n; set<int> num; cin >> N; // 待填充序列 for(int i = 0; i < N; i++){ int tmp; cin >> t 阅读全文

posted @ 2021-09-02 11:52 Atl212 阅读(61) 评论(0) 推荐(0)

1049 数列的片段和 (20 point(s))
摘要:// 暴力超时 #include <bits/stdc++.h> using namespace std; int main() { // 截取连续片段 计算片段和 // 一种方法 顺序循环从第一位开始 // 用一个片段和变量记录之前所走过变量的和 并累加到结果 double n, part, su 阅读全文

posted @ 2021-09-01 17:52 Atl212 阅读(70) 评论(0) 推荐(0)

1048 数字加密 (20 point(s))
摘要:// 错误魔改后正确版 #include <bits/stdc++.h> using namespace std; int main() { // 加密整数A 加密序列B string A, B, str = "0123456789JQK" ; cin >> A >> B; // 高位补零 // 获 阅读全文

posted @ 2021-09-01 16:03 Atl212 阅读(128) 评论(0) 推荐(0)

1047 编程团体赛 (20 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n, max = 0; map<int, int> result; cin >> n; while(n--){ int num, i, score; // 队伍编号1-100 阅读全文

posted @ 2021-09-01 12:19 Atl212 阅读(20) 评论(0) 推荐(0)

1046 划拳 (15 point(s))
摘要:#include <bits/stdc++.h> using namespace std; int main() { int n, sayA, handA, sayB, handB, loseA = 0, loseB = 0; cin >> n; while(n--){ cin >> sayA >> 阅读全文

posted @ 2021-09-01 11:57 Atl212 阅读(41) 评论(0) 推荐(0)

1045 快速排序 (25 point(s))
摘要:#include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; int main() { // 取主元 左小右大 判断主元个数 int n, a[100000], b[2][100000], max = 0, min = IN 阅读全文

posted @ 2021-09-01 11:35 Atl212 阅读(65) 评论(0) 推荐(0)

导航