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

Re:哎呀,又超时了,该怎么该呀!!!

Posted by 90401524 at 2005-01-07 16:02:09 on Problem 1552
In Reply To:哎呀,又超时了,该怎么该呀!!! Posted by:00430030 at 2004-12-23 13:01:55
#include<stdio.h>
#include<math.h>
void main () {
    int i,j=0,m,n,a[15];//数组最好是在开的大一点
    for(;;)
{
   for(i=0;;i++)
{
scanf("%d",&a[i]);
if(a[i]==0) goto l;
else if(a[i]==-1) goto end;
}l:
for(m=0;m<i;m++)
for(n=0;n<i;n++)
{if(2*a[m]==a[n]) j=j+1;
else continue;//好像是不需要
}
printf("%d\n",j);//你这个j循环一次就不是0了
end:;
}  
}

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