HDU 2035 ( 人见人爱A^B )

来源:互联网 发布:淘宝评价管理怎么清零 编辑:程序博客网 时间:2024/05/02 02:47
Problem : 2035 ( 人见人爱A^B )     Judge Status : AcceptedRunId : 5683762    Language : C++    Author : ssunCode Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta#include<iostream>using namespace std;int pow_mod(int a,int b){    if(b==1) return a;    __int64 x = pow_mod(a,b/2);    __int64 ans = x * x % 1000;    if(b%2==1) ans = ans * a % 1000;    return (int)ans;}int main(){    int a,b,i;    while(scanf("%d%d",&a,&b)!=EOF)    {        if(a==0 && b==0) break;        printf("%d\n",pow_mod(a,b));    }    return 0;}


原创粉丝点击