人见人爱A^B(HDU 2035)
Problem Description
Input
Output
Sample Input
Sample Output
解题思路:快速幂模板题
 AC代码:
#include <iostream>
using namespace std;
int quick_power(int a,int n)
{
    int ans = 1;
    while (n)
    {
        if (n % 2) ans = ans * a % 1000;//指数是奇数
        a = a * a % 1000;//底数平方(数据范围大,一般在乘法的地方取模)
        n >>= 1;//指数减半
    }
    return ans;
}
int main()
{
    int a,b;
    while (cin >> a >> b)
    {
        if (a == 0 && b == 0) break;
        
        int res = quick_power(a,b);
        cout << res << endl;
    }
    return 0;
}
解方程(HDU 2899)
Problem Description
Input
Output
Sample Input
Sample Output










