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 cradlewenwen at 2007-05-16 16:55:30 on Problem 1019
#include<stdio.h>
main()
{
int t,i,j,sum,a[10];
scanf("%d",&t);
for(i=0;i<t;i++)
  {
  scanf("%d",&a[i]);
  sum=0;j=0;
  while(sum<a[i])
   {
   sum=sum+j;
   j++;
  }
  sum=sum-j+1;
  if(a[i]-sum!=0)
  printf("%d",a[i]-sum);
  else
  printf("%d",j-1);
  }
  getch();
}

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