Skip to content

Commit c8c8e3a

Browse files
committed
Update
1 parent 7d52933 commit c8c8e3a

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

3/1.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int n = 1260;
6+
int cnt = 0;
7+
int types[4] = {500, 100, 50, 10};
8+
9+
int main() {
10+
for (int i = 0; i < 4; i++) {
11+
int coin = types[i];
12+
cnt += n / coin;
13+
n %= coin;
14+
}
15+
cout << cnt << '\n';
16+
}

3/1.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import java.util.Scanner;
2+
3+
public class Main {
4+
5+
public static void main(String[] args) {
6+
int n = 1260;
7+
int cnt = 0;
8+
int[] types = {500, 100, 50, 10};
9+
10+
for (int i = 0; i < 4; i++) {
11+
int coin = types[i];
12+
cnt += n / coin;
13+
n %= coin;
14+
}
15+
16+
System.out.println(cnt);
17+
}
18+
19+
}

0 commit comments

Comments
 (0)