SergeyPGUTI

9.5(степень)

Mar 20th, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. int main()
  2. {
  3.     int N,M,Y,step;
  4.     bool check=true;
  5.     cin>>N>>M>>Y;
  6.     for(int i=0;i<M;i++)
  7.     {
  8.         step=1;
  9.         for(int j=0;j<N;j++)
  10.         {
  11.             step*=i;
  12.             step%=M;
  13.         }
  14.         if (step%M==Y) {cout<<i<<" ";check=false;}
  15.     }
  16.  
  17.     if (check) cout<<-1;
  18.  return 0;
  19. }
Add Comment
Please, Sign In to add comment