Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define DEBUG
- #define max3(x, y, z) max(max((x), (y)), (z))
- #define min3(x, y, z) min(min((x), (y)), (z))
- #define watch(x) cout << #x << " is " << x << endl
- using namespace std;
- #pragma GCC target ("avx2")
- #pragma GCC optimization ("O3")
- #pragma GCC optimization ("unroll-loops")
- int main() {
- // ios_base::sync_with_stdio(0);
- // cin.tie(NULL);
- // freopen("input.txt", "r", stdin);
- int n, mod;
- int shekel[3];
- int count[3];
- fill(count, count+3, 0);
- cin >> n;
- mod = n;
- for(int i = 0; i < 3; i++) {
- cin >> shekel[i];
- }
- for(int i = 2; i >= 0; i--) {
- count[i] = mod / shekel[i];
- mod -= shekel[i] * count[i];
- }
- if(mod != 0) {
- fill(count, count+3, 0);
- int kr = 0;
- if(n % shekel[1] == 0) kr = 1;
- count[kr] = n / shekel[kr];
- n -= count[kr] * shekel[kr];
- }
- for(int i = 0; i < 3; i++) {
- cout << count[i] << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment