Development/Algorithm
[SWEA] 2072. 홀수만 더하기
동스토리
2020. 9. 18. 20:28
반응형
문제
SW Expert Academy
SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!
swexpertacademy.com
코드
#include<iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int testcase;
int T;
int result = 0;
int Input;
cin >> T;
for (testcase = 0; testcase < T; ++testcase) {
for (int i = 0; i < 10; ++i)
{
cin >> Input;
if (Input % 2 == 1) result += Input;
}
cout << "#" << testcase + 1 << " " << result << '\n';
result = 0;
}
}
반응형