0
How can I modify this code to get efficient output for 10^10 . Within 2second
def palindrome(a): org=a a=str(a) return int(a[::-1])==org if 1 else 0 def factor(a): b=[palindrome(i) for i in range(1,a+1) if a%i==0] return b t=int(input()) j=1 while(t): a=int(input()) l=factor(a) print("case #",j,": ",sum(l),sep="") j+=1 t-=1 I tried more way but can't
3 Antworten
+ 2
Sudalai Vignesh ,
? Do I understand correctly that you want to calculate 10 to the power of 10. are there any restrictions to consider ?
it would be nice if you could give us some explanation what the code is doing.
+ 1
Print(10 ** 10) ?
0
It finds factors of the give no. And count how many palindrome are there for the given test cases