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