| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
you are right, thank you. but is it a problem of the test data? still puzzle..In Reply To:Re:i try many times on this problem, but stil got wrong answer, anyone help me.. Posted by:ACMTino at 2006-09-30 02:47:39 > same problem as mine
>
> I guess that you should not revise value of n, or you would got wrong answer
>
> below is your ac code
> good luck
>
> ACMTino
>
> #include<cstdio>
>
> int main()
> {
> __int64 t,n,k,sm;
> __int64 m;
> scanf("%I64d",&t);
> while(t--)
> {
> scanf("%I64d%I64d%I64d",&n,&k,&sm); m=sm;
> __int64 o=1,base,ans=1,p;
> p=k;
> for(base=10;p;p/=2,base=(base*base)%m)
> if(p&1) o=(o*base)%m;
> o=(o+1)%m;
> p=n;
> for(base=o;p;p/=2,base=(base*base)%m)
> if(p&1) ans=(ans*base)%m;
> printf("%I64d\n",ans);
> }
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator