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;
- a=0;
- for(int i=1000;i<=9999;i++)
- {
- poi=i;
- poa=0;
- while(i>0)
- {
- x = i % 10;
- i /= 10;
- if(x==0)
- {
- a+=6;
- }
- if(x==1)
- {
- a+=3;
- }
- if(x==2)
- {
- a+=5;
- }
- if(x==3)
- {
- a+=5;
- }
- if(x==4)
- {
- a+=4;
- }
- if(x==5)
- {
- a+=5;
- }
- if(x==6)
- {
- a+=5;
- }
- if(x==7)
- {
- a+=3;
- }
- if(x==8)
- {
- a+=7;
- }
- if(x==9)
- {
- a+=5;
- }
- }
- i=poi;
- if(n==a)
- {
- i1 = i;
- }
- a=poa;
- }
- cout << i1 << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement