기록하는 개발자

[백준][JAVA] 2839 : 설탕 배달 본문

Algorithm

[백준][JAVA] 2839 : 설탕 배달

밍맹030 2021. 7. 11. 16:06
728x90

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		if (N == 4 || N == 7) System.out.println(-1);
		else if (N % 5 == 0) System.out.println(N / 5);
		else if (N % 5 == 1 || N % 5 == 3) System.out.println((N / 5) + 1);
		else if (N % 5 == 2 || N % 5 == 4) System.out.println((N / 5) + 2);
	}
}

728x90