Advertisement
Spocoman

10. Profit

Sep 12th, 2023
894
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.    
  7.     int oneBGNCoinCount, twoBGNCoinCount, fiveBGNCoinCount, sum;
  8.     cin >> oneBGNCoinCount >> twoBGNCoinCount >> fiveBGNCoinCount >> sum;
  9.  
  10.     for (int i = 0; i <= oneBGNCoinCount; i++) {
  11.         for (int j = 0; j <= twoBGNCoinCount; j++) {
  12.             for (int k = 0; k <= fiveBGNCoinCount; k++) {
  13.                 if (i * 1 + j * 2 + k * 5 == sum) {
  14.                     cout << i << " * 1 lv. + " << j << " * 2 lv. + " << k << " * 5 lv. = " << sum << " lv.\n";
  15.                 }
  16.             }
  17.         }
  18.     }
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement