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

用数学的方法为什么WA??

Posted by RUNSLOWLY at 2008-05-17 15:41:18 on Problem 1019
#include<stdio.h>
#include<math.h>
void main()
{
	int i,n,k,sum;
	scanf("%d",&k);
	while(k--)
	{
		scanf("%d",&n);
		i=(int)sqrt(2*n);
		if(i*(i+1)/2-n<0)
			i++;
		sum=i-i*(i+1)/2+n;
		printf("%d\n",sum);
	}
}

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