기술 블로그

13300번 방 배정 본문

알고리즘 문제/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, 0sizeof(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
반응형

'알고리즘 문제 > BOJ' 카테고리의 다른 글

2573번 빙산  (0) 2018.10.31
1032번 명령 프롬프트  (0) 2018.10.29
11758번 CCW  (0) 2018.10.28
2003번 수들의 합 2  (0) 2018.10.27
2178번 미로 탐색  (0) 2018.10.27