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

哪错了啊 付易懂的程序c

Posted by mathsoft at 2006-03-03 15:43:53 on Problem 1019
#include<stdio.h>
#include<math.h>
int main()
{int i,n;
 long test[10],N;
 double root;
 scanf("%d",&n);
 for(i=0;i<n;i++)
 {scanf("%ld",&test[i]);
  root=(-1.0+sqrt(1+8.0*test[i]))/2;
  N=long(root);
  if((root-N)==0.0) printf("%ld\n",N);
  else printf("%ld\n",long(test[i]-(N*(N+1.0)/2)));
 }
}

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