Sinh Test trong Python va code AC
P1:
#file = "C:/New folder/aka/1.inp"#with open(file) as f:# a,b=[int(x) for x in next(f).split()]#print(a)#print(b) def gg(id): file="C:/New folder/aka/"+id+".inp" with open(file) as f: a,b=[int(x) for x in next(f).split()] products = set() for pair in [(x,y) for x in range(2,a+1) for y in range(2,b+1)]: products.add(pair[0]**pair[1]) return len(products) x=range(1,101) for i in x: id=str(i) file1 = "C:/New folder/aka/"+id+".out" f=open(file1,"w") f.write(str(gg(id))) f.close() P2:
a,b=[int(x) for x in input().split()] product = set() for pair in [(x,y) for x in range(2,a+1) for y in range(2,b+1)]: product.add(pair[0]**pair[1]) print(len(product))
Nhận xét
Đăng nhận xét