团队程序设计天梯赛-练习集
Clovers_ffzz
这个作者很懒,什么都没留下…
展开
-
PTA L1-070:吃火锅 (python)
一、题目要求二、参考代码c=0l=0f=999999while True: s=input() if s=='.': break else: l+=1 if 'chi1 huo3 guo1'in s: c+=1 if f>l: f=lprint(l)if c==0: print('-_-#')else: print('%原创 2022-03-05 14:41:01 · 1007 阅读 · 1 评论 -
PTA L1-069:胎压监测 (python)
一、题目要求二、参考代码s=[int(i) for i in input().split()]c=0for i in range(4): if s[i]<s[4] or (max(s)-s[i])>s[5]: c+=1 t=iif c==0: print('Normal')elif c==1: print('Warning: please check #%d!'%(t+1))else: print('Warning原创 2022-03-05 14:39:34 · 1162 阅读 · 0 评论 -
PTA L1-068:调和平均 (python)
一、题目要求二、参考代码n=int(input())print('%.2f'%(1/(sum([1/float(i) for i in input().split()])/n)))原创 2022-03-05 14:38:11 · 722 阅读 · 0 评论 -
PTA L1-067:洛希极限 (python)
一、题目要求二、参考代码s=input().split()r=float(s[0])if s[1]=='0': r*=2.455else: r*=1.26print('%.2f'%(r),end=' ')if r<float(s[2]): print('^_^')else: print('T_T')原创 2022-03-05 14:37:21 · 1412 阅读 · 0 评论 -
PTA L1-066:猫是液体 (python)
一、题目要求二、参考代码l,w,h = map(int,input().split())print(l*w*h)原创 2022-03-05 14:35:53 · 493 阅读 · 0 评论 -
【无标题】 PTA L1-065:嫑废话上代码 (python)
一、题目要求二、参考代码print('Talk is cheap. Show me the code.')原创 2022-03-05 14:34:38 · 186 阅读 · 0 评论 -
PTA L1-063:吃鱼还是吃肉 (python)
一、题目要求二、参考代码n=int(input())for i in range(n): s=input().split() if s[0]=='1': if int(s[1])<130: print('duo chi yu!',end=' ') elif int(s[1])==130: print('wan mei!',end=' ') else: pri原创 2022-03-05 14:33:34 · 1382 阅读 · 0 评论 -
PTA L1-062:幸运彩票 (python)
一、题目要求二、参考代码n=int(input())for i in range(n): s=input() t1=[int(i) for i in s[:3]] t2=[int(i) for i in s[3:]] if sum(t1)==sum(t2): print('You are lucky!') else: print('Wish you good luck.')原创 2022-03-05 14:31:47 · 1138 阅读 · 2 评论 -
PTA L1-061:新胖子公式 (python)
一、题目要求二、参考代码w,h=map(float,input().split())r=w/pow(h,2)print("%.1f"%(r))if r>25: print('PANG')else: print('Hai Xing')原创 2022-03-05 14:30:55 · 749 阅读 · 0 评论 -
PTA L1-060:心理阴影面积 (python)
一、题目要求二、参考代码x,y = map(int,input().split())print(int(pow(20000,0.5)*abs(-x+y)/pow(2,0.5)/2))注意:考查点到直线的距离原创 2022-03-04 13:34:57 · 812 阅读 · 0 评论 -
PTA L1-059:敲笨钟 (python)
一、题目要求二、参考代码n=int(input())for i in range(n): t=input() s=t.split(',') if s[0][-3:]=='ong' and s[1][-4:-1]=='ong': print(' '.join(t.split()[:-3])+' qiao ben zhong.') else: print('Skipped')注意:在输入古诗情况下逗号后可能有空格,可能没有空格..原创 2022-03-04 13:28:18 · 469 阅读 · 0 评论 -
PTA L1-058:6翻了 (python)
一、题目要求二、参考代码s=input()r=''l=0for i in range(len(s)): if l>1: l-=1 continue if s[i]=='6': l=1 for j in s[i+1:]: if j=='6': l+=1 else: break if l原创 2022-03-04 13:24:47 · 560 阅读 · 0 评论 -
PTA L1-057:PTA使我精神焕发 (python)
一、题目要求二、参考代码print('PTA shi3 wo3 jing1 shen2 huan4 fa1 !')原创 2022-03-04 13:22:10 · 230 阅读 · 0 评论 -
PTA L1-056:猜数字 (python)
一、题目要求二、参考代码n=int(input())p={}a=0win=''for i in range(n): s=input().split() p[s[0]]=int(s[1]) a+=int(s[1])t=100for i in p: if abs(p[i]-a/len(p)/2)<t: t=abs(p[i]-a/len(p)/2) win=iprint('%.0f'%(a/len(p)/2),end=' '原创 2022-03-04 13:20:47 · 354 阅读 · 0 评论 -
PTA L1-055:谁是赢家 (python)
一、题目要求二、参考代码n=[int(i) for i in input().split()]s=input()if s.count(str(n.index(max(n))))>0: if n.index(max(n))==0: print('The winner is a: %s + %d'%(n[0],s.count('0'))) else: print('The winner is b: %s + %d'%(n[1],s.count('原创 2022-03-04 11:06:51 · 864 阅读 · 0 评论 -
PTA L1-054:福到了 (python)
一、题目要求二、参考代码s=input().split()t=[]r=[]for i in range(int(s[1])): a=input() t.append(a) r.append(a[::-1])r.reverse()if r==t: print('bu yong dao le')for i in r: print(i.replace('@',s[0]))原创 2022-03-04 11:05:35 · 332 阅读 · 0 评论 -
PTA L1-053:电子汪 (python)
一、题目要求二、参考代码a,b=map(int,input().split())print('Wang!'*(a+b))原创 2022-03-04 11:03:22 · 356 阅读 · 0 评论 -
PTA L1-052:2018我们要赢 (python)
一、题目要求二、参考代码print('2018')print('wo3 men2 yao4 ying2 !')原创 2022-03-04 11:02:21 · 476 阅读 · 0 评论 -
PTA L1-051:打折 (python)
一、题目要求二、参考代码n,m=map(int,input().split())print("%.2f"%(n*m/10))原创 2022-03-04 11:00:58 · 1054 阅读 · 0 评论 -
PTA L1-045:宇宙无敌打招呼 (python)
一、题目要求二、参考代码s = input()print("Hello "+s)原创 2022-02-28 14:13:50 · 673 阅读 · 0 评论 -
PTA L1-044:稳赢 (python)
一、题目要求二、参考代码n=int(input())c=0while True: s=input() c+=1 if s=='End': break elif c%(n+1)==0: print(s) else: if s=='ChuiZi': print('Bu') elif s=='JianDao': print('ChuiZi')原创 2022-02-28 14:12:51 · 690 阅读 · 0 评论 -
PTA L1-042:日期格式化 (python)
一、题目要求二、参考代码date = input()print(date[-4:]+'-'+date[0:5])原创 2022-02-28 14:11:23 · 797 阅读 · 0 评论 -
PTA L1-041:寻找250 (python)
一、题目要求二、参考代码s=input().split()print(s.index('250')+1)原创 2022-02-28 14:10:26 · 1016 阅读 · 0 评论 -
PTA L1-040:最萌情侣身高差 (python)
一、题目要求二、参考代码n=int(input())for i in range(n): s=input().split() if s[0]=='F': print('%.2f'%(float(s[1])*1.09)) if s[0]=='M': print('%.2f'%(float(s[1])/1.09))原创 2022-02-22 21:23:01 · 1614 阅读 · 0 评论 -
PTA L1-039:古风排版 (python)
一、题目要求二、参考代码n=int(input())s=input()for i in range(n): print( ''.join(reversed(s[i::n])).rjust(len(s[0::n]),' '))原创 2022-02-22 21:20:58 · 823 阅读 · 0 评论 -
PTA L1-038:新世界 (python)
一、题目要求二、参考代码print('Hello World')print('Hello New World')原创 2022-02-22 21:19:33 · 367 阅读 · 0 评论 -
PTA L1-037:A除以B (python)
一、题目要求二、参考代码a,b=map(int,input().split())if b<0: print('%d/(%d)=%.2f'%(a,b,a/b))elif b==0: print('%d/%d=Error'%(a,b))else: print('%d/%d=%.2f'%(a,b,a/b))原创 2022-02-22 21:18:04 · 936 阅读 · 0 评论 -
PTA L1-036:A乘以B (python)
一、题目要求二、参考代码a,b=map(int,input().split())print(a*b)原创 2022-02-22 21:16:00 · 1683 阅读 · 0 评论 -
PTA L1-035:情人节 (python)
一、题目要求二、参考代码lst = []while True: t = input() if t == '.': break lst.append(t)if 2>len(lst): print('Momo... No one is for you ...')elif 2<=len(lst)<14: print(lst[1]+' is the only one for you...')else: print(l原创 2022-02-21 21:43:00 · 436 阅读 · 0 评论 -
PTA L1-033:出生年 (python)
一、题目要求二、参考代码t=input().split()y=int(t[0])while True: if len(set(str(y).rjust(4,'0')))==int(t[1]): print(str(y-int(t[0]))+' '+str(y).rjust(4,'0')) break else: y+=1原创 2022-02-21 21:40:41 · 423 阅读 · 0 评论 -
PTA L1-032:Left-pad (python)
一、题目要求二、参考代码n=input().split()s=input()if int(n[0])>len(s): print(s.rjust(int(n[0]),n[1]))else: print(s[len(s)-int(n[0]):])原创 2022-02-21 21:38:46 · 230 阅读 · 0 评论 -
PTA L1-031:到底是不是太胖了 (python)
一、题目要求二、参考代码n = int(input())for i in range(n): s = [int(i) for i in input().split()] if abs(s[1]-(s[0]-100)*0.9*2)<(s[0]-100)*0.9*0.1*2: print('You are wan mei!') else: if (s[1]-(s[0]-100)*0.9*2)>0: print('原创 2022-02-21 21:36:58 · 1152 阅读 · 0 评论 -
PTA L1-030:一帮一 (python)
一、题目要求二、参考代码n=int(input())s=[]t=[]for i in range(n//2): s.append(input().split())for i in range(n//2): t.append(input().split())for i in s: for j in range(len(t)-1,-1,-1): if (int(i[0])+int(t[j][0]))==1: print(i[1]+原创 2022-02-21 20:19:09 · 759 阅读 · 1 评论 -
PTA L1-029:是不是太胖了 (python)
一、题目要求二、参考代码h = int(input())print('%.1f'%((h-100)*0.9*2))原创 2022-02-21 20:17:00 · 405 阅读 · 0 评论 -
PTA L1-028:判断素数 (python)
一、题目要求二、参考代码import mathdef judge(a): if a==1: return False if a==2: return True for i in range(2,int(math.sqrt(a))): if a%i==0: return False return Truen = int(input())for i in range(n): t = int原创 2022-02-21 20:15:42 · 2113 阅读 · 0 评论 -
PTA L1-027:出租 (python)
一、题目要求二、参考代码s=input()r=''arr=''t=sorted(list(set(i for i in s)),reverse=True)for i in t: arr+=i arr+=','for i in s: r+=str(t.index(i)) r+=','print('int[] arr = new int[]{%s};'%(arr[:-1]))print('int[] index = new int[]{%s};'%(r[:-1]))原创 2022-02-21 20:14:21 · 452 阅读 · 0 评论 -
PTA L1-026:I Love GPLT (python)
一、题目要求二、参考代码for i in 'I Love GPLT': print(i)原创 2022-02-21 20:12:10 · 394 阅读 · 0 评论 -
PTA L1-025:正整数A+B (python)
一、题目要求二、参考代码arr=input()s=['','']c=0for i in arr: if i!=' ': s[0]+=i c+=1 else: breaks[1]=arr[c+1:]flag=[0,0]for i in range(2): try: t=int(s[i]) if t<1 or t>1000: flag[i]=1原创 2022-02-20 16:17:19 · 857 阅读 · 0 评论 -
PTA L1-024:后天 (python)
一、题目要求二、参考代码day = int(input())if day == 5: print(7)else: print((day+2)%7)原创 2022-02-20 16:14:09 · 470 阅读 · 1 评论 -
PTA L1-023:输出GPLT (python)
一、题目要求二、参考代码s=input().upper()g=s.count('G')p=s.count('P')l=s.count('L')t=s.count('T')a=min(g,p,l,t)print('GPLT'*a,end='')g-=ap-=al-=at-=awhile (g+p+l+t)>0: if g>0: print('G',end='') g-=1 if p>0: print(原创 2022-02-20 16:13:06 · 475 阅读 · 0 评论