Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- //
- // Created by Kadir Kadyrov on 08.07.2020.
- // Copyright © 2020 Kadir Kadyrov. All rights reserved.
- //
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- int ans = 0;
- ans += n / 100;
- n %= 100;
- ans += n / 20;
- n %= 20;
- ans += n / 10;
- n %= 10;
- ans += n / 5;
- n %= 5;
- ans += n;
- cout << ans << endl;
- }
- //-------------
- //
- // main.cpp
- //
- // Created by Kadir Kadyrov on 08.07.2020.
- // Copyright © 2020 Kadir Kadyrov. All rights reserved.
- //
- #include <iostream>
- #include <algorithm>
- using namespace std;
- //7
- //5 2
- // 2 2 3
- int main() {
- int n;
- cin >> n;
- int k = n / 2;
- cout << k << endl;
- if (n % 2 == 1) {
- cout << 3 << ' ';
- k--;
- }
- // while(k--) {
- // cout << 2 << ' ';
- // }
- // cout << endl;
- for (int i = 0; i < k; i++) {
- cout << 2 << ' ';
- }
- cout << endl;
- }
- //--------------------
- //
- // main.cpp
- //
- // Created by Kadir Kadyrov on 08.07.2020.
- // Copyright © 2020 Kadir Kadyrov. All rights reserved.
- //
- #include <iostream>
- #include <algorithm>
- using namespace std;
- //7
- //5 2
- // 2 2 3
- int main() {
- int t;
- cin >> t;
- for (int i = 0; i < t; i++) { //while(t--)
- int b, p, f;
- cin >> b >> p >> f;
- int h, c;
- cin >> h >> c;
- b /= 2;
- int ans = 0;
- if (h > c) {
- ans += min(b, p) * h;
- b -= min(b, p);
- ans += min(b, f) * c;
- } else {
- ans += min(b, f) * c;
- b -= min(b, f);
- ans += min(b, p) * h;
- }
- cout << ans << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement