[구현/수학] 백준 9713 Sum of Odd Sequence - 파이썬(Python)


[구현/수학] 백준 9713 Sum of Odd Sequence - 파이썬(Python)

[ Contents ] 1. 문제 (링크 참조) 9713번: Sum of Odd Sequence First line of the input contains T, the number of test cases. Each test case contains a single integer N. N is between 1 and 100. www.acmicpc.net 2. 문제 풀이 N개의 정수가 주어집니다. 그 중 홀수만을 더한 값을 구해야 합니다. 3. 코드 # 입력 T = int(input()) for _ in range(T): N = int(input()) res = 0 for i in range(N): if i % 2 == 1: res += i print(res+N)


원문링크 : [구현/수학] 백준 9713 Sum of Odd Sequence - 파이썬(Python)