hdu 2035 反复平方法

#include <cstdio>#include <stack>#include <iostream>using namespace std;int fun(int a,int b){//int c = 0;int d = 1;stack<int> st;while(b){st.push(b & 1);b >>= 1l;}while(!st.empty()){int t = st.top();st.pop();//c <<= 1;d = d*d %1000;if(t == 1){//c ++;d = (d*a)%1000;}}return d;}int main(){int a,b;while(cin >> a >> b,a||b){cout << fun(a,b) << endl;}return 0;}

版权声明:本文为博主原创文章,未经博主允许不得转载。

,的这一半更多地赢取上帝掌握的那一半。

hdu 2035 反复平方法

相关文章:

你感兴趣的文章:

标签云: