-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathN2720.java
More file actions
57 lines (46 loc) · 963 Bytes
/
Copy pathN2720.java
File metadata and controls
57 lines (46 loc) · 963 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package baekjun;
import java.util.Scanner;
public class N2720 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("시행 횟수 입력");
int T = scanner.nextInt();
double Q = 25;
double D = 10;
double N = 5;
double P = 1;
int[] coin = new int[4];
int count = 0;
for (int i=0; i < T; i++) {
System.out.println("잔돈 입력 : ");
int C = scanner.nextInt();
while(C > Q) {
C -= Q;
count ++;
}
coin[0] = count;
count = 0;
while(C > D) {
C -= D;
count ++;
}
coin[1] = count;
count = 0;
while(C > N) {
C -= N;
count ++;
}
coin[2] = count;
count = 0;
while(C >= P) {
C -= P;
count ++;
}
coin[3] = count;
for(int j = 0; j < coin.length; j ++) {
System.out.print(coin[j] + " ");
}
System.out.println();
}
}
}