Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int N,M,Y,step;
- bool check=true;
- cin>>N>>M>>Y;
- for(int i=0;i<M;i++)
- {
- step=1;
- for(int j=0;j<N;j++)
- {
- step*=i;
- step%=M;
- }
- if (step%M==Y) {cout<<i<<" ";check=false;}
- }
- if (check) cout<<-1;
- return 0;
- }
Add Comment
Please, Sign In to add comment