folstfolst
全部博文(64)
2010年(64)
Phyllis6
分类: C/C++
2010-01-26 13:39:56
#include<iostream> using namespace std; int Exp(int a,int b,int n); int main(void){ int a,b,n; cin>>a>>b>>n; cout<<Exp(a,b,n)<<endl; system("pause"); return 0; } int Exp(int a,int b,int n){ int d=1,t=a; while(b>0){ if(b&1) d = d*t % n; b /= 2; t = ((t % n) * (t % n))%n; } return d; }
上一篇:压位高精度
下一篇:已知二叉树的中序后序遍历求先序
登录 注册