알고리즘 문제/BOJ
13300번 방 배정
parkit
2018. 10. 28. 12:42
728x90
반응형
https://www.acmicpc.net/problem/13300
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #include <iostream> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <math.h> #include <algorithm> #include <map> using namespace std; int main(void) { int N = 0, K = 0, room = 0; int S = 0, Y = 0; int student[2][7] = { 0, }; memset(student, 0, sizeof(student)); scanf("%d %d", &N, &K); for (int i = 0; i < N; i++) { scanf("%d %d", &S, &Y); ++student[S][Y]; //아래 2줄은 내가 실수했던 부분 //if (student[S][Y] == 1) ++room; //else if (student[S][Y] > K) ++room; } for (int i = 0; i <= 1; i++) { for (int j = 1; j <= 6; j++) { room += (student[i][j] + K - 1) / K; } } printf("%d\n", room); return 0; } | cs |
728x90
반응형