2539
-
[백준][BOJ][JAVA]2539_설탕배달백준 2022. 7. 27. 21:13
그 뭔가 코드가 굉장히 길어지긴 했는데 이보다 더 짧게 만들 수 가 있나 ...? import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int result = 0; result = n / 5; n %= 5; if (n % 3 == 0 ){ result += n/3; System.out.println(result); } else if (n % 3 != 0 ){ while(true){ result -= 1; n += 5; if(result >=0 ){ if(n %3 == 0){ result += ..