#8420: Easiest method [Quicksort]


AdrianIainLam (AdrianIainLam)

學校 : St, Paul's College
編號 : 33325
來源 : [59.149.105.253]
最後登入時間 :
2014-05-15 21:18:54
a233. 排序法~~~ 挑戰極限 -- 24TH 成功電研社內考 | From: [46.23.68.180] | 發表日期 : 2013-12-03 06:37

/**********************************************************************************/
/*  Problem: a233 "排序法~~~ 挑戰極限" from 24TH 成功電研社內考     */
/*  Language: C (346 Bytes)                                                       */
/*  Result: AC(0.3s, 4.2MB) judge by this@ZeroJudge                               */
/*  Author: AdrianIainLam at 2013-12-03 06:23:27                                  */
/**********************************************************************************/


#include <stdio.h>
#include <stdlib.h>

int compare (const void * a, const void * b)
{
  return ( *(int*)a - *(int*)b );
}

int main() {
    int n;
    int a[1000010];
    scanf("%d", &n);
    int i;
    for(i=0;i<n;i++) scanf("%d", &a[i]);
    qsort(a, n, sizeof(int), compare);
    for(i=0;i<n;i++) printf("%d%c", a[i], i==n-1?10:32);
    return 0;
}
 
ZeroJudge Forum