12345678910111213141516 |
- //我是个傻逼
- #include <bits/stdc++.h>
- using namespace std;
- int encrypt(int m,int e,int n){int c=1;for(int i=0;i<e;i++){c=(c*m)%n;}return c;}
- int decode(int c,int d,int n){int m=1;for(int i=0;i<d;i++){m=(m*c)%n;}return m;}
- int m,c,e,n,d;
- int main (){
- cin>>n>>e>>d;
- cin>>m;
- c=encrypt(m,e,n);
- cout<<c<<endl;
- m=decode(c,d,n);
- cout<<m<<endl;
- system("pause");
- return 0;
- }
|