模重复平方计算

2019-04-13 12:20发布

#include using namespace std; #define MAXLEN 1000 void Dec_To_Bin(int Dec,int *Bin,int *len) { int i=0; while(Dec) { Bin[i]=Dec%2; Dec/=2; i++; } *len=i; } int ModRepeatSquare(int b,int n,int m) { int a=1,t=b; int len,Bin[MAXLEN]; Dec_To_Bin(n,Bin,&len); for(int i=0;i>b>>n>>m; cout<