-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11047.cpp
More file actions
33 lines (32 loc) · 695 Bytes
/
11047.cpp
File metadata and controls
33 lines (32 loc) · 695 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
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#pragma warning(disable:4996)
#define _CRT_SECURE_NO_WARNINGS
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n,left;
int coin[10] = { 0, };
cin >> n>>left;
int set = n-1;
int size = 0;
for (int i = 0; i < n; i++) {
cin >> coin[i];
}
while (left != 0) {
int use = left / coin[set];
left = left - use * coin[set];
// printf("%d %d %d", coin[set], use, left);
set--;
size += use;
}
printf("%d", size);
return 0;
}