문제 풀이
오늘의 문제 - 백준14916.거스름돈
나의 풀이
import java.io.*;
import java.util.*;
public class Main{
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int answer = -1;
int N = Integer.parseInt(br.readLine());
for(int i=N/5;i>=0;i--){
if((N - (5 * i))%2 == 0){
answer = i + (N - (5 * i))/2;
break;
}
}
bw.write(answer + "");
bw.flush();
bw.close();
br.close();
}
}