Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- Binary Search
- dynamic programming
- 자바
- two pointers
- Data Structure
- Counting
- 코테
- array
- hash table
- sorting
- bit manipulation
- SQL
- Class
- 파이썬
- implement
- Math
- Stack
- string
- Binary Tree
- Number Theory
- database
- simulation
- Matrix
- Tree
- java
- geometry
- greedy
- Method
- 구현
- 코딩테스트
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.0] 피자 나눠 먹기 (1) 본문
1. Input
1) 피자를 나눠먹을 사람 수 n
2. Output
1) 모든 사람이 최소 1조각 이상씩 먹기 위해 필요한 피자의 판 수
2) 피자는 1판 당 7조각
3. Constraint
1) 1 <= n <= 100
4. Example
Input: n=6 -> Output: 1
Input: n=15 -> Output: 3
5. Code
1) 첫 코드(2022/10/18)
if(n<=7)
return 1;
else if(n%7==0)
return n/7;
else
return n/7 +1;
2) 간결하게 수정(2022/10/18)
return n%7==0 ? n/7 : n/7 +1;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.0] 피자 나눠 먹기 (3) (0) | 2022.10.19 |
---|---|
[프로그래머스/Lv.0] 피자 나눠 먹기 (2) (0) | 2022.10.19 |
[프로그래머스/Lv.0] 짝수는 싫어요 (0) | 2022.10.18 |
[프로그래머스/Lv.0] 중앙값 구하기 (0) | 2022.10.18 |
[프로그래머스/Lv.0] 나머지 구하기 (0) | 2022.10.18 |