분류 전체보기
-
13300) 방 배정 c++백준코딩일기 2020. 10. 17. 08:12
문제 ) www.acmicpc.net/problem/13300 13300번: 방 배정 표준 입력으로 다음 정보가 주어진다. 첫 번째 줄에는 수학여행에 참가하는 학생 수를 나타내는 정수 N(1 ≤ N ≤ 1,000)과 한 방에 배정할 수 있는 최대 인원 수 K(1 < K ≤ 1,000)가 공백으로 분리되어 www.acmicpc.net 풀이 ) 2차원 배열 stu[2][6] 을 이용해서 학생 수를 구했다. stu[2][6] 에서 [2] 는 남자(0), 여자(1) 의 수를 넣고, [6]은 초등학교의 학년을 나타내었다. 1명이라도 남으면 방이 하나 더 있어야 하므로 stu[i][j] % K != 0 이라면 room 을 하나 올려주기로 했다. 코드 ) #include using namespace std; int ..