[백준] 📂. (13300번) 방 배정
🗒️ 13300번) 방 배정
#include <iostream>
using namespace std;
int student[7][2]; // [1학년~6학년], [여, 남]
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, K;
cin >> N >> K;
while (N--)
{
int S, Y;
cin >> S >> Y;
++student[Y][S];
}
int room(0);
for (int y = 0; y < 7; y++)
for (int s = 0; s < 2; s++)
room += (student[y][s] / K) + (student[y][s] % K ? 1 : 0);
cout << room;
return 0;
}
댓글남기기