Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
66909 胡海峰老师 最简真分数 Python3 Compile Error 0 MS 0 KB 476 2024-03-11 15:32:27

Tests(0/0):


Code:

def max_common_divisor(x,y): if x<y: x,y = y,x t = y while t!=1: if x%t==0 and y%t==0: break t -=1 return t n = int(input()) a = list(map(int,input().split())) a.sort() cnt =0 for i in range(n-1): for j in range(i+1,n): ai = a[i] aj = a[j] if aj%ai!=0: if max_common_divisor(ai,aj)==1: print( f"{ai}/{aj}") cnt +=1 print(cnt)


Run Info:

  File "Main.py", line 22
    print( f"{ai}/{aj}")
                      ^
SyntaxError: invalid syntax