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

想到枚举以为超时了,结果0ms,我晕

Posted by TSERROF at 2012-08-18 15:21:59 on Problem 2853
#include <cstdio>
int main()
{
	int T;
	scanf("%d",&T);
	for(int k=1;k<=T;++k)
	{
		int number,t;
		scanf("%d%d",&t,&number);
		int ans=0,sum=0;
		printf("%d ",k);
		for(int i=1;(i+2)*(i+1)<=2*number;++i)
		{
			sum+=i;
			if((number-sum)%(i+1)==0)++ans;
		}
		printf("%d\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