View Code of Problem 3800

#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;

#define MAX(a,b) (a)>(b)?(a):(b);
#define MAXN 10010
typedef long long ll;

int main()
{
    ll a,b;
    while(~scanf("%lld%lld",&a,&b))
    {
        if(!a&&!b) break;
        ll t=a;
        t%=1000;
        for(int i=2;i<=b;i++)
            t=t*a%1000;
        printf("%lld\n",t);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 3800