人生苦短,我用python
我感觉我这种做法太邪恶了。。。
class Solution:
def addDigits(self, num):
"""
:type num: int
:rtype: int
"""
num=str(num)#变成字符串来进行处理
count=0
while len(num)!=1:
for i in num:
count += int(i)
num=str(count)
count=0
return int(num)