본문 바로가기
  • Let's study
PS/Baekjoon

[백준] 10874: 이교수님의 시험(C++)

by 코딩고수이고파 2025. 5. 14.

문제

https://www.acmicpc.net/problem/10874

코드

#include <iostream>

using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n, a;
	cin >> n;

	for (int i = 1; i <= n; i++) {
		int cnt = 0;

		for (int j = 1; j <= 10; j++) {
			cin >> a;
			if ((j - 1) % 5 + 1 == a)
				cnt++;
		}
		if (cnt == 10)
			cout << i << '\n';
	}
	
	return 0;
}

댓글