forked from deepanshumishra/JavaAndCPP_programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFLOW005.java
More file actions
39 lines (34 loc) · 767 Bytes
/
Copy pathFLOW005.java
File metadata and controls
39 lines (34 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package codechef_lib;
import java.util.Scanner;
public class FLOW005 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i=1;i<=t;i++) {
int money = sc.nextInt();
int c =0;
while(money!=0) {
if(note_val(money)<=money) {
money = money-note_val(money);c++;
}
}
System.out.println(c);
}
}
public static int note_val(int money) {
if(money>=100) {
return 100;
}else if(money<100 && money>=50) {
return 50;
}else if(money<50 && money>=10) {
return 10;
}else if(money<10 && money>=5) {
return 5;
}else if(money<5 && money>=2) {
return 2;
}else {
return 1;
}
}
}