1、数列和
import math m,n = map(int, raw_input().split()) answer = [] for i in range(n): answer.append(m) m = math.sqrt(m) print ‘%.2f‘ % sum(answer)
2、水仙花数
m,n = map(int,raw_input().split()) answer = [] def isFlower(x): return x == sum([int(i)**3 for i in str(x)]) for i in range(m,n+1): if isFlower(i): answer.append(str(i)) if len(answer) != 0: print " ".join(answer) else: print ‘no‘
3、句子反转
import sys print(" ".join(raw_input().strip().split(" ")[::-1]))
时间: 2024-11-02 23:06:11