1 class Solution:
2     def isArmstrong(self, N: int) -> bool:
3         ns = str(N)
4         lens = len(ns) 
5         sums = 0
6         for n in ns:
7             cur = int(n)
8             sums += cur ** lens
9         return True if sums == N else False

 

posted on 2019-07-27 23:32  Sempron2800+  阅读(168)  评论(0编辑  收藏  举报