题解 | #约数的个数#
约数的个数
https://www.nowcoder.com/practice/04c8a5ea209d41798d23b59f053fa4d6
from math import sqrt from math import ceil while True: try: times=int(input()) list1=list(map(int,input().strip().split())) sum=1 count=0 for i in range(times): sum=1 j=2 if list1[i]==1: print(1) continue elif list1[i]==2: print(2) continue elif list1[i]==3: print(2) continue while j*j<=list1[i]: if list1[i]%j==0: while list1[i]%j==0: count+=1 list1[i]//=j sum*=(count+1) j+=1 count=0 if list1[i]>1: count+=1 sum*=(count+1) print(sum) count=0 except EOFError: break