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

请问1019这样做错在哪里?

Posted by hongye at 2006-05-09 21:13:12
#include<stdio.h>
#include<math.h>
#define N 10
int main()
{
 int n,i;
 unsigned long m[N],y,x;
 scanf("%d",&n);
 for(i=0;i<n;i++)
   scanf("%ld",&m[i]);
 for(i=0;i<n;i++)
 {
  x=sqrt(2*m[i]);
  y=x*(x+1)/2;
  if(y-m[i]>=0)
   m[i]=x-y+m[i];
  else
   m[i]=m[i]-y;
 }
 for(i=0;i<n;i++)
  printf("%ld\n",m[i]);
 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