蓝桥杯python组——既约分数 import os import sys import math #math.gcd()方法 它接受两个整数并返回其最大公约数 count = 0 for i in range ( 1 , 2021 ): for j in range ( 1 , 2021 ): if math . gcd ( i , j ) == 1 : #pri
蓝桥杯python组——既约分数
import osimport sys
import math #math.gcd()方法 它接受两个整数并返回其最大公约数
count = 0
for i in range(1,2021):
for j in range(1,2021):
if math.gcd(i,j) == 1:
#print("{}/{}".format(i,j))
count += 1
print(count)
答案为2481215
谢谢大家的支持,您的一键三连是 罡罡同学前进的最大动力!