Algorithm
BOJ 13300 방 배정 c++
BOJ 13300 방 배정 c++ 백준 13300 방 배정 c++ #include using namespace std; int boy[8]; int girl[8]; int n, k; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> k; while (n--) { int gender, grade; cin >> gender >> grade; if (gender == 0) { girl[grade]++; } else { boy[grade]++; } } int ans = 0; for (int i = 1; i 0) { ans++; boy[i] -= k; } while (girl[i] > 0) { ans++; girl[i] -= k; } } cout
2020. 8. 14. 20:46
최근댓글