結果

問題 No.275 中央値を求めよ
ユーザー hape8810
提出日時 2019-01-08 13:21:35
言語 C
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 460 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 30,592 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-24 00:40:57
合計ジャッジ時間 7,596 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void){
    int A[1000],N,x,i,d;
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",A[i]);
    }
    for(i=0;i<N-1;i++){
        for(d=i;d<N;d++){
            if(A[i]>A[d]){
                A[i]=x;
                A[d]=A[i];
                A[i]=x;
            }
        }
    }
    if(N%2==0){
        printf("%.1f\n",(A[N/2-1]+A[N/2])/2.0);
    }
    else{
        printf("%.1f\n",(double)A[N/2]);
    }
    return 0;
}
0