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 sndnyangd at 2010-08-16 20:13:20 on Problem 2388
#include<stdio.h>/*Who's in the middle*/
#include<stdlib.h>
#define SIZE 10010
int Cmp(const void *a,const void *b)
{return *(int *)a-*(int *)b;}
int main()
{
    int i,n,a[SIZE];
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&a[i]);
    qsort(a,n,sizeof(int),Cmp);    
    printf("middle=%d\n",a[n/2]);
    return 0;
}
输出的是 middle=%d,居然忘了,WA了两三次。。。。

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