随笔分类 -  团体程序设计天梯赛-练习集

摘要:python 实现: s=input() hour_str=str(s.split(":")[0]) # 在00到23之间 min_str=str(s.split(":")[1]) # 在00到59之间 hour=int(hour_str) min=int(min_str) if hour<12 o 阅读全文
posted @ 2024-07-24 16:32 豆豆是只乖狗狗 阅读(10) 评论(0) 推荐(0) 编辑
摘要:python 实现 参考:https://blog.csdn.net/m0_74101869/article/details/131479677 num1=int(input()) friends=set() for i in range(num1): s=input().split() if s[ 阅读全文
posted @ 2024-07-06 19:07 豆豆是只乖狗狗 阅读(6) 评论(0) 推荐(0) 编辑
摘要:python实现 num=int(input()) lst=[] for i in range(num): s=input() n=int(s.split(" ")[0]) for j in range(n): lst.append(int(s.split(" ")[j+1])) lst.sort( 阅读全文
posted @ 2024-07-05 21:42 豆豆是只乖狗狗 阅读(6) 评论(0) 推荐(0) 编辑
摘要:python 实现 s=str(input()) lst=[0,0,0,0] for item in s: if item=="G" or item=="g": lst[0]+=1 elif item=="P" or item=="p": lst[1]+=1 elif item=="L" or it 阅读全文
posted @ 2024-07-05 17:30 豆豆是只乖狗狗 阅读(7) 评论(0) 推荐(0) 编辑
摘要:python实现: 需要考虑很多情况: 如果只输入一个数:分子/分母 是否有商,是否需要约分,如:8/3,-8/3,0/3。 如果输入多个数:通分后分子>0,<0还是=0,分子/分母 是否有商,是否需要约分。 num=int(input()) s=input() if num==1: fenzi=i 阅读全文
posted @ 2024-07-04 22:07 豆豆是只乖狗狗 阅读(21) 评论(0) 推荐(0) 编辑
摘要:python 实现 s=str(input()) lst_s=[] lst_info=[] lst_num=[] for i in s: if int(i) not in lst_info: lst_info.append(int(i)) lst_s.append(int(i)) lst_info. 阅读全文
posted @ 2024-07-04 21:00 豆豆是只乖狗狗 阅读(4) 评论(0) 推荐(0) 编辑
摘要:python 实现 s=input() a=int(s.split(" ")[0]) b=str(s.split(" ")[1]) row=0 if float(a/2)-int(a/2)>=0.5: row=int(a/2)+1 else: row=int(a/2) for i in range( 阅读全文
posted @ 2024-07-03 18:38 豆豆是只乖狗狗 阅读(9) 评论(0) 推荐(0) 编辑
摘要:python实现 a=str(input()) b=str(input()) for i in b: while i in a: loc=a.index(i) a=a[:loc]+a[loc+1:] print(a) 阅读全文
posted @ 2024-07-03 18:08 豆豆是只乖狗狗 阅读(2) 评论(0) 推荐(0) 编辑
摘要:python实现 s=str(input()) factor1=1.0 if s[0]=="-": factor1=1.5 s=s[1:] l=len(s) count=0 for i in s: if i=="2": count+=1 factor2=1.0 if int(s)%2==0: fac 阅读全文
posted @ 2024-07-03 16:21 豆豆是只乖狗狗 阅读(8) 评论(0) 推荐(0) 编辑
摘要:python 实现 num=int(input()) lst=[] while True: s=str(input()) if s!="End": lst.append(s) else: break count=0 for item in lst: if count!=num: if item==" 阅读全文
posted @ 2024-07-03 16:05 豆豆是只乖狗狗 阅读(4) 评论(0) 推荐(0) 编辑
摘要:python 实现 num=int(input()) lst_res=[] for i in range(num): temp=str(input()) if int(temp[0])+int(temp[1])+int(temp[2]) == int(temp[3])+int(temp[4])+in 阅读全文
posted @ 2024-07-03 15:42 豆豆是只乖狗狗 阅读(4) 评论(0) 推荐(0) 编辑
摘要:python 实现 num1=int(input()) lst_id=[] lst_shiji=[] lst_kaoshi=[] for i in range(num1): s=input() lst_id.append(int(s.split(" ")[0])) lst_shiji.append( 阅读全文
posted @ 2024-07-03 15:32 豆豆是只乖狗狗 阅读(6) 评论(0) 推荐(0) 编辑
摘要:python 实现 num=int(input()) lst=[] for i in range(num): s=input() a=int(s.split(" ")[0]) b=int(s.split(" ")[1]) res=int(s.split(" ")[2]) if a*b==res: l 阅读全文
posted @ 2024-07-03 11:31 豆豆是只乖狗狗 阅读(11) 评论(0) 推荐(0) 编辑
摘要:python 实现 s=input() sum=int(s.split(" ")[0])+int(s.split(" ")[1]) fac=1 for i in range(1,sum+1): fac=fac*i print(fac) 阅读全文
posted @ 2024-07-03 11:25 豆豆是只乖狗狗 阅读(13) 评论(0) 推荐(0) 编辑
摘要:python 实现 注:输入的数据需要在区间 [1,1000] 内 s=input() loc=s.index(" ") a=s[:loc] b=s[loc+1:] if a.isdecimal() and b.isdecimal(): if int(a) in [i for i in range( 阅读全文
posted @ 2024-06-30 20:54 豆豆是只乖狗狗 阅读(19) 评论(0) 推荐(0) 编辑
摘要:python 实现 注:测试的时候最后一个测试点总是不通过,最后发现,测试数据可能是一个不含空格的长单词,单词内同样包含6,如: 输入: zhangsan666-lisi666666-wangwu6666666666 输出: zhangsan666-lisi9-wangwu27 s=input() 阅读全文
posted @ 2024-06-30 16:50 豆豆是只乖狗狗 阅读(6) 评论(0) 推荐(0) 编辑
摘要:python 实现 s=input() num=int(s.split(" ")[0]) dream_price=int(s.split(" ")[1]) lst=[] for i in range(num): real_price=float(input()) if real_price<drea 阅读全文
posted @ 2024-06-30 13:07 豆豆是只乖狗狗 阅读(8) 评论(0) 推荐(0) 编辑
摘要:python实现 num=int(input()) s=input() sum=0.0 for i in range(num): f=1.0/float(s.split(" ")[i]) sum+=f sum=1.0/(sum/float(num)) print("{:.2f}".format(su 阅读全文
posted @ 2024-06-30 12:58 豆豆是只乖狗狗 阅读(6) 评论(0) 推荐(0) 编辑
摘要:python 实现 s=input() year=s[:len(s)-2] month=s[len(s)-2:len(s)] if len(year)==4: print("{year}-{month}".format(year=year, month=month)) else: if int(ye 阅读全文
posted @ 2024-06-29 17:39 豆豆是只乖狗狗 阅读(8) 评论(0) 推荐(0) 编辑
摘要:python 实现 num=int(input()) id_lst=[] for i in range(num): s=str(input()) id_lst.append(s) lst_right=[7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 阅读全文
posted @ 2024-06-29 17:20 豆豆是只乖狗狗 阅读(20) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示