알고리즘
-
2839 - 설탕배달알고리즘 2023. 5. 23. 10:32
https://www.acmicpc.net/problem/2839 2839번: 설탕 배달 상근이는 요즘 설탕공장에서 설탕을 배달하고 있다. 상근이는 지금 사탕가게에 설탕을 정확하게 N킬로그램을 배달해야 한다. 설탕공장에서 만드는 설탕은 봉지에 담겨져 있다. 봉지는 3킬로그 www.acmicpc.net 문제요약 특정 무게의 설탕을 3kg, 5kg 봉지로 담을 수 있는 최소 봉지의 갯수 구하기 만약 3kg, 5kg 봉지로 나눌 수 없다면, -1을 출력하기 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = sc.nextIn..