Skip to content

Commit ee5d78d

Browse files
committed
[level 0] Title: 피자 나눠 먹기 (3), Time: 0.04 ms, Memory: 80.3 MB -BaekjoonHub
1 parent afc444f commit ee5d78d

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# [level 0] 피자 나눠 먹기 (3) - 120816
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120816)
4+
5+
### 성능 요약
6+
7+
메모리: 80.3 MB, 시간: 0.04 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩테스트 입문
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 04월 17일 15:35:43
20+
21+
### 문제 설명
22+
23+
<p>머쓱이네 피자가게는 피자를 두 조각에서 열 조각까지 원하는 조각 수로 잘라줍니다. 피자 조각 수 <code>slice</code>와 피자를 먹는 사람의 수 <code>n</code>이 매개변수로 주어질 때, <code>n</code>명의 사람이 최소 한 조각 이상 피자를 먹으려면 최소 몇 판의 피자를 시켜야 하는지를 return 하도록 solution 함수를 완성해보세요.</p>
24+
25+
<hr>
26+
27+
<h5>제한사항</h5>
28+
29+
<ul>
30+
<li>2 ≤ <code>slice</code> ≤ 10</li>
31+
<li>1 ≤ <code>n</code> ≤ 100</li>
32+
</ul>
33+
34+
<hr>
35+
36+
<h5>입출력 예</h5>
37+
<table class="table">
38+
<thead><tr>
39+
<th>slice</th>
40+
<th>n</th>
41+
<th>result</th>
42+
</tr>
43+
</thead>
44+
<tbody><tr>
45+
<td>7</td>
46+
<td>10</td>
47+
<td>2</td>
48+
</tr>
49+
<tr>
50+
<td>4</td>
51+
<td>12</td>
52+
<td>3</td>
53+
</tr>
54+
</tbody>
55+
</table>
56+
<hr>
57+
58+
<h5>입출력 예 설명</h5>
59+
60+
<p>입출력 예 #1</p>
61+
62+
<ul>
63+
<li>10명이 7조각으로 자른 피자를 한 조각 이상씩 먹으려면 최소 2판을 시켜야 합니다.</li>
64+
</ul>
65+
66+
<p>입출력 예 #2</p>
67+
68+
<ul>
69+
<li>12명이 4조각으로 자른 피자를 한 조각 이상씩 먹으려면 최소 3판을 시켜야 합니다.</li>
70+
</ul>
71+
72+
73+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution {
2+
public int solution(int slice, int n) {
3+
int answer = 0;
4+
5+
if(n%slice == 0) answer = n/slice;
6+
else answer = n/slice+1;
7+
8+
return answer;
9+
}
10+
}

0 commit comments

Comments
 (0)