题解 | #最简真分数#
最简真分数
https://www.nowcoder.com/practice/1f1db273eeb745c6ac83e91ff14d2ec9
def gcd(a,b): if b==0: return a else: return gcd(b,a%b) while True: try: times=int(input()) list1=list(map(int,input().strip().split())) list1.sort(key=None,reverse=False) if times==0: continue count=0 for i in range(times): for j in range(i,times,1): gc=gcd(list1[i],list1[j]) if (gc==1)and(list1[i]<list1[j]): count+=1 print(count) except EOFError: break