标签:ret space scan out std return typedef type can
#include<iostream>
#include<stdio.h>
using namespace std;
typedef long long ll;
ll q_pow(ll a,ll b,ll mod)
{
ll ans=1;
while(b!=0)
{
if(b&1)
ans=ans*a%mod;
b>>=1;
a=a*a%mod;
}
return ans%mod;
}
int main ()
{
int n,k;
while(scanf("%d%d",&n,&k)!=EOF)
{
if (n==0 && k==0)
break;
ll m1=(q_pow(2,3*n+1,250*k)-1)*(q_pow(251,n+1,250*k)-1);
ll m=m1%(250*k);
m=m/250;
ll s=(q_pow(2008,m,k)+k)%k;
cout<<s<<endl;
}
return 0;
}
标签:ret space scan out std return typedef type can
原文地址:https://www.cnblogs.com/huanya/p/9374612.html