알고리즘/SWAE

[python] 2072. 홀수만 더하기 D1

황성안 2022. 8. 10. 14:33
728x90

출저 : https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=1&contestProbId=AV5QSEhaA5sDFAUq&categoryId=AV5QSEhaA5sDFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=PYTHON&select-1=1&pageSize=10&pageIndex=1 

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
= int(input())
for tc in range(1, T + 1):
    N = list(map(int, input().split()))
    lengN = len(N)
 
    totalN = 0
    for i in range(0, lengN):
        if N[i]%2 == 1:
            temp = N[i]
            totalN = totalN + temp
    print("#{} {}".format(tc, totalN))
 
 
cs

 

728x90