- 博客(147)
- 资源 (2)
- 收藏
- 关注
原创 PAT (Basic Level) Practice (中文)1028 人口普查
题目测试点4格式错误,合法的身份证为0,后面不能有空格,最大最小年龄也不用输出。测试点5运行超时,还是一样用sys.stdin.readline替换input
2022-06-11 22:03:49
535
原创 PAT (Basic Level) Practice (中文)1025 反转链表
题目测试点5运行超时,用sys.stdin.readline().split()替换掉input().split()测试点6非零返回,是因为提前出现-1,链表从中间断开,感觉这个测试点跟题目不符
2022-06-10 16:06:56
172
原创 PAT (Basic Level) Practice (中文)1038 统计同成绩学生
题目不要用列表list内置函数count,不然最后一个测试点会超时
2022-06-08 15:43:48
120
原创 PAT (Basic Level) Practice (中文)1020 月饼
题目第三个测试点2非零返回是因为,月饼数量和价格有可能是浮点数,不能用整数存储。
2022-06-06 16:13:52
153
原创 PAT (Basic Level) Practice (中文)1019 数字黑洞
题目1、注意结果不足四位要补0,否则运行超时。2、第六个测试点5输入为6174,要至少输出一轮。3、第345个测试点234输入不足4位,要补0。
2022-06-06 15:29:19
154
原创 PAT (Basic Level) Practice (中文)1008 数组元素循环右移问题
题目要注意m>=n的情况,否则第三个测试点2答案错误;第二个测试点1存在非零返回bug,不允许使用以下代码要改为
2022-06-02 16:43:14
123
原创 PAT (Basic Level) Practice (中文)1007 素数对猜想
题目第一个循环是[5, n+1),没有n+1第二个测试点1不通过;最后一个超时要把判断素数的循环改成到i的平方根,使得程序从O(n^2)变为O(根号n)。
2022-06-02 16:07:31
123
原创 PAT (Basic Level) Practice (中文)1012 数字分类
题目第九个测试点8有一个坑点,就是当A2等于0时,符合条件的数字不一定是没出现过,只是刚好相加减最后结果为0if __name__ == '__main__': inputs = input().split(" ") A1 = "0" hasA1 = False A2 = "0" hasA2 = False flag2 = 1 A3 = "0" hasA3 = False num4 = 0 A4 = "0" hasA
2022-05-30 17:24:48
132
原创 PAT (Basic Level) Practice (中文)1005 继续(3n+1)猜想
题目if __name__ == '__main__': n = int(input()) m = [] r = [] inputs = input().split(" ") for i in inputs: if m.count(int(i)) != 0: continue num = int(i) while num != 1: if num % 2 == 0:
2022-05-29 16:52:00
110
原创 PAT (Basic Level) Practice (中文)1004 成绩排名
题目if __name__ == '__main__': n = int(input()) maxScore = 0 minScore = 100 maxRes = "" minRes = "" for i in range(n): inputs = input().split(" ") if maxScore < int(inputs[2]): maxScore = int(inputs[2])
2022-05-29 15:59:14
66
原创 PAT (Basic Level) Practice (中文)1003 我要通过
题目需要注意:左侧A的数量*中间A的数量=右侧A的数量分析在这里:分析if __name__ == '__main__': n = int(input()) res = [] for i in range(n): s = input() isTrue = True hasA = False l = 0 m = 0 r = 0 if s.count("P") == 1
2022-05-29 15:53:30
84
原创 PAT (Basic Level) Practice (中文)1002 写出这个数
题目if __name__ == '__main__': n = input() s = 0 r = "" m = {"1": "yi", "2": "er", "3": "san", "4": "si", "5": "wu", "6": "liu", "7": "qi", "8": "ba", "9": "jiu", "0": "ling"} for i in n: s += int(i) for i in str(s):
2022-05-29 13:02:06
60
原创 PAT (Basic Level) Practice (中文)1106 2019数列
题目第二个测试点1会给出n<4的情况if __name__ == '__main__': n = int(input()) r = "2019" if n < 4: r = r[:n] else: for i in range(4, n): s = int(r[i - 4]) + int(r[i - 3]) + int(r[i - 2]) + int(r[i - 1]) r +=
2022-05-29 12:57:01
142
原创 PAT (Basic Level) Practice (中文)1101 B是A的多少倍
题目if __name__ == '__main__': a, n = input().split(" ") b = a[-int(n):] + a[:-int(n)] print("%.2f" % (int(b) / int(a)))
2022-05-29 12:46:26
88
原创 PAT (Basic Level) Practice (中文)1096 大美数
题目a整除b是b % a == 0if __name__ == '__main__': n = int(input()) res = [] inputs = input().split(" ") for i in inputs: ns = [] isR = False for j in range(1,int(i) + 1): if int(i) % j == 0: n
2022-05-29 12:08:54
183
原创 PAT (Basic Level) Practice (中文)1091 N-自守数
题目if __name__ == '__main__': n = int(input()) res = [] inputs = input().split(" ") for i in inputs: has = False for j in range(10): s = str(int(i) * int(i) * (j+1)) if s[-(len(i)):] == i:
2022-05-29 11:35:09
61
原创 PAT (Basic Level) Practice (中文)1086 就不告诉你
题目当反过来开头数字为0要舍弃,否则第二个测试点1和第三个测试点2答案错误if __name__ == '__main__': inputs = input().split(" ") r = str(int(inputs[0]) * int(inputs[1])) res = "" for i in r: res = i + res while res[0] == "0": res = res[1:] print(res)
2022-05-29 11:09:37
69
原创 PAT (Basic Level) Practice (中文)1081 检查密码
题目if __name__ == '__main__': n = int(input()) r = [] for i in range(n): m = input() digit = False alpha = False luan = False if len(m) < 6: r.append("Your password is tai duan le.")
2022-05-29 11:02:40
74
原创 PAT (Basic Level) Practice (中文)1076 Wifi密码
题目if __name__ == '__main__': n = int(input()) r = "" m = {"A": 1, "B": 2, "C": 3, "D": 4} for i in range(n): inputs = input().split(" ") for j in range(4): if inputs[j][-1] == "T": r += str(m[inp
2022-05-28 22:55:16
97
原创 PAT (Basic Level) Practice (中文)1066 图像过滤
if name == ‘main’:m, n, a, b, t = input().split(" “)res = []for i in range(int(m)):r = “”inputs = input().split(” “)for j in range(int(n)):if int(a) <= int(inputs[j]) <= int(b):r += (”%03.u " % int(t))else:r += ("%03.u " % int(inputs[j]))r
2022-05-28 22:44:55
99
原创 PAT (Basic Level) Practice (中文)1071 小赌怡情
题目if __name__ == '__main__': money, n = input().split(" ") res = [] for i in range(int(n)): inputs = input().split(" ") if int(inputs[2]) > int(money): res.append("Not enough tokens. Total = %s." % money)
2022-05-28 22:30:33
91
原创 PAT (Basic Level) Practice (中文)1061 判断题
题目if __name__ == '__main__': n, m = input().split(" ") score = input().split(" ") answer = input().split(" ") res = [] for i in range(int(n)): student = input().split(" ") r = 0 for j in range(int(m)):
2022-05-27 17:36:56
88
原创 PAT (Basic Level) Practice (中文)1056 组合数的和
题目if __name__ == '__main__': inputs = input().split(" ") res = set() for i in range(1, len(inputs)): for j in range(1, len(inputs)): if j != i: num = inputs[i] + inputs[j] res.add(num) su
2022-05-27 17:27:56
73
原创 PAT (Basic Level) Practice (中文)1051 复数乘法
题目该题需要注意的是,第三个测试点2和第四个测试点3会有输出格式问题的考虑,当0>a>-0.005时,a应当四舍五入为0.00,但计算机会单独取符号位最后变成-0.00,因此需要考虑这一点import mathif __name__ == '__main__': inputs = input().split(" ") A1 = float(inputs[0]) * math.cos(float(inputs[1])) B1 = float(inputs[0]) *
2022-05-26 16:02:17
121
原创 PAT (Basic Level) Practice (中文)1046 划拳
题目if __name__ == '__main__': n = int(input()) aa = [] ab = [] ba = [] bb = [] for i in range(n): inputs = input().split(" ") aa.append(int(inputs[0])) ab.append(int(inputs[1])) ba.append(int(inputs[2
2022-05-26 15:35:52
85
原创 PAT (Basic Level) Practice (中文)1041 考试座位号
题目if __name__ == '__main__': n = int(input()) students = [] exams = [] tests = [] for i in range(n): inputs = input().split(" ") students.append(int(inputs[0])) exams.append(int(inputs[1])) tests.append(
2022-05-26 15:34:48
73
原创 安装了gmp却找不到undefined reference to symbol ‘__gmpz_init‘
g++ -lgmp main.cpp改为g++ main.cpp -lgmp
2022-05-20 03:33:18
759
原创 cuda没有checkCudaError或找不到helper_cuda.h文件
checkCudaError方法在helper.cuda.h头文件里而该头文件在/usr/local/cuda/samples/command/inc里,windows电脑在C:/ProgramData/NVIDIA Corporation/CUDA Samples/v11.5/common/inc
2022-05-19 15:18:30
2097
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人