14916번: 거스름돈1 99클럽 코테 스터디 14일차 TIL (14916번: 거스름돈) 문제https://www.acmicpc.net/problem/14916학습 키워드그리디 시도(성공) 5원으로 교환할 수 있는 최대값부터 시작해서 5원으로 교환하고 남은 돈을 2원으로 전부 교환할 수 있는지 판단하기 풀이 및 코드import java.util.*;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int answer = 0; for (int fiveWon = n / 5; fiveWon >= 0; fiveWon--) { int remainderN = n - (5 * fiveWon); if (remainderN % 2.. 2024. 11. 11. 이전 1 다음