Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MAin {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int N;
- N = sc.nextInt();
- int paricki = N;
- for(int a = 0; a <= N; a++) {
- for(int b = 0; b <= N; b++) {
- for(int c = 0; c <= N; c++) {
- for(int d = 0; d <= N; d++) {
- for(int e = 0; e <= N; e++) {
- if(a*50 + b*10 + c*5 + d*2 + e*1 == N) {
- paricki = Math.min(paricki, a + b + c + d + e);
- }
- }
- }
- }
- }
- }
- System.out.println(paricki);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement