PTA-团体程序设计天梯赛-Python解法
HuSmall2un2
欢迎探讨。
你的点赞,我的动力。
展开
-
L1-020 帅到没朋友 (20分)
n = int(input()) s = set() for i in range(n): l = input().split() if l[0] == '1': continue for j in l[1:]: s.add(j) m = int(input()) l = input().split() ls = [] ll = set() for i in l: if (i not in s) and (i not in ll): .原创 2020-07-29 00:07:24 · 237 阅读 · 0 评论 -
L1-009 N个数求和 (20分)
我原本的想法是求所有分母的最小公倍数进行通分,然后按情况输出,但始终有一个答案错误或者超时 所以我就使用了fractions库,简单粗暴。 from fractions import Fraction n = int(input()) l = input().split() x = '0' for i in l: x=Fraction(x)+Fraction(i) if x==int(x): print(x) elif abs(int(x))>=1: print...原创 2020-07-07 23:10:43 · 340 阅读 · 0 评论