You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include<bits/stdc++.h>
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
int quick(int a,int b)
|
|
|
|
|
{
|
|
|
|
|
int s = 1;
|
|
|
|
|
while (b > 0) {
|
|
|
|
|
if (b & 1) {//b=b>>1<><31>֤<EFBFBD><D6A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>϶<EFBFBD><CFB6><EFBFBD>ִ<EFBFBD>и<EFBFBD>if<69>ж<EFBFBD>
|
|
|
|
|
s = s * a;
|
|
|
|
|
}
|
|
|
|
|
a = a * a;
|
|
|
|
|
cout<<"b="<<b<<endl;
|
|
|
|
|
cout<<"s="<<s<<endl;
|
|
|
|
|
cout<<endl;
|
|
|
|
|
b = b >> 1;
|
|
|
|
|
}
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
printf("%d",quick(2,10));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|