[백준] Baekjoon Online Judge
문제
The Call for Problems for the ICPC North America Qualifier (NAQ) has finished, and a number of problems were proposed. The judges voted on the difficulty of each problem. The NAQ does not want to be considered an odd contest, so therefore they refuse to use any problem which has an odd number (not divisible by two) for a difficulty rating.
Given the difficulty ratings of the candidate problems, how many were excluded by this rule?
입력
The first line of input contains a single integer n (1≤n≤50), which is the number of candidate problems.
Each of the next 𝑛n lines contains a single integer d (0≤d≤100), which are the difficulty ratings of the n problems.
출력
Output a single integer, which is the number of candidate problems excluded by the rule.
풀이
#include <iostream>
using namespace std;
int main() {
int n, cnt = 0;
cin >> n;
while (n--) {
int r;
cin >> r;
if (r % 2 == 1) cnt++;
}
cout << cnt << '\n';
return 0;
}
'백준 > C++' 카테고리의 다른 글
[Baekjoon/C++] 16946번 - 벽 부수고 이동하기 4 (0) | 2024.12.07 |
---|---|
[Baekjoon/C++] 20303번 - 할로윈의 양아치 (0) | 2024.12.05 |
[Baekjoon/C++] 16724번 - 피리 부는 사나이 (0) | 2024.11.29 |
[Baekjoon/C++] 1976번 - 여행 가자 (0) | 2024.11.26 |
[Baekjoon/C++] 32651번 - 인간은 무엇인가 (0) | 2024.11.23 |