Skip to content

Commit

Permalink
백준/단계별: 설탕 배달 문제풀이 (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
sieunnnn committed Sep 22, 2023
1 parent 11ecf99 commit 82bdc90
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/baekjoon/step/bruteForce/PROB2839.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package baekjoon.step.bruteForce;

import java.util.Scanner;

public class PROB2839 {

static Scanner sc = new Scanner(System.in);
static int N;
static int cnt = 0;

public static void main(String[] args) {
N = sc.nextInt();

while (true) {
if (N % 5 == 0) {
cnt += (N / 5);
break;

} else if (N < 0) {
cnt = -1;
break;
}

N -= 3;
cnt ++;
}

System.out.println(cnt);
}
}

0 comments on commit 82bdc90

Please sign in to comment.