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 |
WeirdI suspected that Judge has some bug in it. if I change ************************************************** t=n; count=0; while(n) { b[count++]=n%2; n/=2; } ************************************************** to t=n; count=0; while(t) { b[count++]=t%2; t/=2; } it would get accepted please check it, thanks ACMTino #include<stdio.h> #include<stdlib.h> main() { __int64 i,j,cases; __int64 n,k,m,t,count,result; bool b[50]; scanf("%I64d",&cases); while(cases--) { scanf("%I64d %I64d %I64d",&n,&k,&m); t=k; count=0; while(t) { b[count++]=t%2; t/=2; } t=10; result=1; for(i=0;i<count;++i) { if(b[i]) result=(result*t)%m; t=(t*t)%m; } result=(result+1)%m; t=n; count=0; while(n) { b[count++]=n%2; n/=2; } t=result; result=1; for(i=0;i<count;++i) { if(b[i]) result=(result*t)%m; t=(t*t)%m; } printf("%I64d\n",result); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator