We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Enter your code here. Read input from STDIN. Print output to STDOUTn=int(input())#a , b =0a=0foriinrange(n):forjinrange(n):p=pow(i,j)#print (p)p=str(p)p=list(p)q=0forkinrange(len(p)):q=q+int(p[k])if(a<q):a=qprint(a)
Project Euler #56: Powerful digit sum
You are viewing a single comment's thread. Return to all comments →
my solution in python
There are quite a few things that can be improved for the performance obcessed:
Just a few thoughts.
Are you sure that a* * b is faster than pow(a,b)?