Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int M;
- cin >> M;
- int ckorcinja[10] = {6, 3, 5, 5, 4, 5, 5, 3, 7, 5};
- for(int i = 9999; i >= 1000; i -= 1) {
- int tmp = i;
- int potrebni_ckorcinja = 0;
- while(tmp > 0) {
- int cifra = tmp % 10;
- potrebni_ckorcinja += ckorcinja[cifra];
- tmp /= 10;
- }
- if(potrebni_ckorcinja == M) {
- cout << i << endl;
- return 0;
- }
- }
- cout << -1 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement