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

我在自己的TC上运行是正确的啊!!!为什么提交不对呢?赋有代码

Posted by tcxgsy at 2005-08-10 15:33:04 on Problem 2549
#include<stdio.h>
#include<math.h>

main()
{long i,j,k;
 long a[5000],temp;
 long n,b=0;
 
   scanf("%d",&n);
   while(n)
     {  for(i=0;i<n;i++)
         scanf("%ld",&a[i]);
       for(i=0;i<n-1;i++)
          for(j=n-1;j>i;j--)
             if(a[i]<a[j])  {temp=a[j];
                             a[j]=a[i];
                             a[i]=temp;
                             }
         b=0;
         for(i=1;i<n-2;i++)
           for(j=i+1;j<n-1;j++)
             for(k=j+1;k<n;k++)
            {  if(a[0]==a[i]+a[j]+a[k])  
                          b=1;   }
                   if(b==1)  printf("%ld\n",a[0]);
                  else printf("no solution\n");
           scanf("%d",&n);
      }
}  

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