source: SPOJ.com - Problem SMPSUM
#SMPSUM-Iterated sums
#2021-10-03
'''
a = int(input())
b = int(input())
these two can't input in the same line
'''
a,b = map(int,input().split())
c = 0
for _ in range (a,b+1):
c += _*_
print(c)
1. end='' can't used on INT
2. input().split() the most common way
3. map (func, iterables)
本文介绍了如何解决SPOJ中的SMPSUM问题,涉及整数输入、范围内的累加和计算,使用了map函数和for循环。通过实例演示了如何用Python实现输入两个整数a和b,计算从a到b(包含a和b)的和。

被折叠的 条评论
为什么被折叠?



