T3000

Problema J

Oct 22nd, 2021
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n,a,r,x;
  8.  
  9.     a=11;
  10.     while(n!=0)
  11.     {
  12.  
  13.        
  14.         while(r!=1)
  15.         {  
  16.             cin>>n;
  17.             x=n*a;
  18.             if((n%10)+(n%100)/10+(n%1000)/100+(n%10000)/1000+(n%100000)/10000 == (x%10)+(x%100)/10+(x%1000)/100+(x%10000)/1000+(x%100000)/10000)
  19.             {
  20.  
  21.                 cout<<a<<endl;
  22.                 r=1;
  23.             }
  24.             else
  25.             {
  26.                 a=a+1;
  27.             }
  28.         }
  29.         r=0;
  30.  
  31.     }
  32.  
  33.     return 0;
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment