Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

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 on Problem 3012
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator