http://codeup.kr/problem.php?id=1279
Codeup 1279 - 홀수는 더하고 짝수는 빼고 1
a, b = map(int, input().split())
result = 0
for i in range(a, b+1):
if i % 2 == 0:
result -= i
else:
result += i
print(result)
'알고리즘 문제 풀기 > Codeup' 카테고리의 다른 글
Codeup 1281 - 홀수는 더하고 짝수는 빼고 3 (0) | 2019.02.08 |
---|---|
Codeup 1280 - 홀수는 더하고 짝수는 빼고 2 (0) | 2019.02.07 |
Codeup 1278 - 자릿수 계산 (0) | 2019.02.07 |
Codeup 1276 - 팩토리얼 계산 (0) | 2019.02.06 |
Codeup 1275 - k 제곱 구하기 (0) | 2019.02.06 |