![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT (Basic Level) Practise
宁静的猫
这个作者很懒,什么都没留下…
展开
-
1002. 写出这个数 (20)
str = input()num = ['ling','yi','er','san','si','wu','liu','qi','ba','jiu']sum = 0for i in range(len(str)): sum = sum + (ord(str[i]) - ord('0'))s=[]while True: if sum==0: break原创 2017-01-30 16:31:00 · 115 阅读 · 0 评论 -
1003. 我要通过!(20)
通过左边,中间,右边字母A的个数来判断是否正确,当然之前要排除错误的情况def panduan(s): cntp=0 cntt=0 for i in range(len(s)): if s[i]!='P' and s[i]!='A' and s[i]!='T': return 0 elif s[i]=='P':原创 2017-01-30 16:33:19 · 104 阅读 · 0 评论 -
1001. 害死人不偿命的(3n+1)猜想 (15)
第一次用写CSDN博客,先放一些简单的题目,以前用c刷完过PAT乙级的题目,最近比较喜欢python,就先上python的代码,c的以后再说n = int(input())count = 0while n != 1: if n % 2 == 0 : n = n / 2 else: n = (3*n+1)/2 count = coun原创 2017-01-29 19:08:34 · 124 阅读 · 0 评论 -
1004. 成绩排名 (20)
list的功能好强大。。n=int(input())s=[]for i in range(n): str=input() name=str.split()[0] num=str.split()[1] grade=int(str.split()[2]) t=(name,num,grade) s.append(t)s.sort(key=lam原创 2017-01-30 16:42:37 · 116 阅读 · 0 评论 -
1005. 继续(3n+1)猜想 (25)
key中放关键数字,notkey中放非关键数字n = int(input())i=0key = []notkey = []nums = input()for num in nums.split(): num=int(num) if num not in notkey: key.append(num) else: continu原创 2017-01-31 16:56:11 · 93 阅读 · 0 评论