| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- elasticsearch
- 독후감
- 백준
- 자바
- 엘라스틱서치
- 이펙티브
- effective
- java
- error
- Web
- 후기
- kibana
- nodejs
- 맛집
- 알고리즘
- Git
- 리뷰
- node
- JPA
- Spring
- 스프링
- MySQL
- 자바스크립트
- javascript
- 인터페이스
- java8
- Spring Boot
- jface
- boot
- RCP
Archives
- Today
- Total
wedul
백준 2839 - 설탕 배달 본문
반응형
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 | import java.util.Scanner; public class Main { public static void main(String args[]) { int n = new Scanner(System.in).nextInt(); int three = 0, int five = n / 5; int n %= 5; while (five >= 0) { if (n % 3 == 0) { three = n / 3; n %= 3; break; } five--; n += 5; } if (n==0) { System.out.println(five + three); } else { System.out.println(-1); } } } | cs |
반응형
'JAVA > 알고리즘' 카테고리의 다른 글
| 정렬알고리즘 - 선택정렬 (0) | 2018.05.28 |
|---|---|
| 10진수 2진수 변환 (0) | 2018.05.28 |
| 더블링크드 리스트 구현하기 (0) | 2018.05.28 |
| 백준 1924 - 요일 맞추기 (0) | 2018.05.28 |
| 선택정렬, 버블정렬, 삽입정렬 예제 (0) | 2016.12.22 |
