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 |
Re:i try many times on this problem, but stil got wrong answer, anyone help me..In Reply To:i try many times on this problem, but stil got wrong answer, anyone help me.. Posted by:MrRight at 2006-09-30 02:32:59 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