Advertisement
Josif_tepe

Untitled

Mar 15th, 2021
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,x,a, i1 = -1,poi,poa;
  8.     cin>>n;
  9.     a=0;
  10.    for(int i=1000;i<=9999;i++)
  11.    {
  12.        poi=i;
  13.        poa=0;
  14.        while(i>0)
  15.        {
  16.        
  17.            x = i % 10;
  18.            i /= 10;
  19.            if(x==0)
  20.            {
  21.                a+=6;
  22.            }
  23.              if(x==1)
  24.            {
  25.                a+=3;
  26.            }
  27.              if(x==2)
  28.            {
  29.                a+=5;
  30.            }
  31.              if(x==3)
  32.            {
  33.                a+=5;
  34.            }
  35.              if(x==4)
  36.            {
  37.                a+=4;
  38.            }
  39.              if(x==5)
  40.            {
  41.                a+=5;
  42.            }
  43.              if(x==6)
  44.            {
  45.                a+=5;
  46.            }
  47.              if(x==7)
  48.            {
  49.                a+=3;
  50.            }
  51.              if(x==8)
  52.            {
  53.                a+=7;
  54.            }
  55.              if(x==9)
  56.            {
  57.                a+=5;
  58.            }
  59.  
  60.        }
  61.         i=poi;
  62.        if(n==a)
  63.        {
  64.            i1 = i;
  65.        }
  66.         a=poa;
  67.        
  68.    }
  69.     cout << i1 << endl;
  70.     return 0;
  71.  
  72. }
  73.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement