#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int T, K; //T=ํ
์คํธ ์ผ์ด์ค K=๊ฐ๊ฒฉ
int cnt = 0; //cnt=๋์ ๊ฐฏ์ ์ต์๊ฐ
vector<int> v;
cin >> T >> K;
while (T--) {
int N; // ๋์ ์ข
๋ฅ
cin >> N;
v.push_back(N);
}
sort(v.begin(), v.end(),greater<int>());
for (int i = 0; i < v.size(); i++) {
if (K == 0) break;
else if (K >= v[i]) {
cnt += K / v[i];
K %= v[i];
}
}
cout << cnt;
}
'Algorithm ๐ง๐ปโ๐ป > ๋ฐฑ์ค(BOJ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค,c++] 11050๋ฒ - ์ดํญ ๊ณ์1 (0) | 2021.10.26 |
---|---|
[๋ฐฑ์ค,c++] 11049๋ฒ - ํ๋ ฌ ๊ณฑ์ ์์ (0) | 2021.10.26 |
[๋ฐฑ์ค,c++] 11048๋ฒ - ์ด๋ํ๊ธฐ (0) | 2021.10.26 |
[๋ฐฑ์ค,c++] 11023๋ฒ - ๋ํ๊ธฐ 3 (0) | 2021.10.26 |
[๋ฐฑ์ค,c++] 11022๋ฒ - A+B-8 (0) | 2021.10.26 |
[๋ฐฑ์ค,c++] 11021๋ฒ - A+B-7 (0) | 2021.10.26 |
๋๊ธ