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

求解!!

Posted by cugwei at 2004-04-24 11:56:44 on Problem 1019
#include<math.h>
#include<iostream.h>
void main()
{
	int n,i;
	unsigned long p[10],j;
	
	cin>>n;
	while(n>=1&&n<=10)
	{
		for(i=1;i<=n;i++) cin>>p[i];
		for(i=1;i<=n;i++) 
		{
			if(p[i]>=1&&p[i]<=2147483647)
			{
			j=((unsigned long)(sqrt(p[i])*sqrt(8))-1)/2;
					 
				cout<<p[i]-j*(j+1)/2<<endl;
			}
			else break;
		}
		break;
	}
}


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