FEgor04

Coins

Aug 10th, 2019
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4.     int n;
  5.     int shekel[3];
  6.     int count[3];
  7.     cin >> n;
  8.     for(int i = 0; i < 3; i++) {
  9.         cin >> shekel[i];
  10.     }
  11.     for(int i = 2; i >= 0; i--) {
  12.         count[i] = n / shekel[i];
  13.         n -= shekel[i] * count[i];
  14.     }
  15.     for(int i = 0; i < 3; i++) {
  16.         cout << count[i] << " ";
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment