Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <algorithm>
- #include <vector>
- using namespace std;
- int main()
- {
- int namin[7], sc, all, how=1, prom, o[7];
- vector <int> variants;
- bool what = false;
- o[1] = 10;
- o[2] = 50;
- o[3] = 100;
- o[4] = 500;
- o[5] = 1000;
- o[6] = 5000;
- cin >> namin[1] >> namin[2] >> namin[3] >> namin[4] >> namin[5] >> namin[6];
- cin >> sc;
- all = namin[1] * 10 + namin[2] * 50 + namin[3] * 100 + namin[4] * 500 + namin[5] * 1000 + namin[6] * 5000;
- variants.push_back(all / sc);
- prom = all / sc-1;
- while (what== false)
- {
- for (int i = 1; i <= 6; i++)
- {
- if (namin[i] != 0)
- if ((all - o[i]) >= prom*sc)
- {
- what = true;
- break;
- }
- else
- {
- variants.push_back(prom);
- prom--;
- how++;
- break;
- }
- }
- }
- sort(variants.begin(), variants.end());
- cout << how << endl;
- for (int i = 0; i <variants.size(); i++)
- cout << variants[i] << " ";
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment