首页 > 代码库 > hdoj:2035

hdoj:2035

#include <iostream>

using namespace std;


int main()
{
    long a, b;
    while (cin >> a >> b && a != 0 && b != 0)
    {
        long result = a;
        for (long i = 2; i <= b; i++)
        {
            result = (result * a) % 1000;
        }
        cout << result % 1000 << endl;
    }
    return 0;
}

 

hdoj:2035