結果

問題 No.275 中央値を求めよ
ユーザー kmanastasiakmanastasia
提出日時 2019-03-11 01:53:18
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 702 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 29,572 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 19:59:21
合計ジャッジ時間 1,566 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,380 KB
testcase_20 WA -
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 3 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 3 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 0 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 3 ms
4,380 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 WA -
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<stdbool.h>

int main(void){
    int N;
    int num[1000];
    bool End=false;
    float sum;
    
    scanf("%d\n",&N);
    for(int i=0;i<N;i++){
        scanf("%d",&num[i]);
    }
    
    while(End==false){
        bool flag=false;
        for(int i=1;i<=N;i++){
            int a;
            if(num[i-1]>num[i]){
                a = num[i-1];
                num[i-1] = num[i];
                num[i] = a;
                flag=true;
            }
        }
        if(flag==false){
            End=true;
        }
    }

    if(N%2==0){
        sum = (float)((num[(N/2)-1]+num[N/2])/2.0);
    }else{
        sum = (float)(num[N/2]);
    }
    
    printf("%.1f\n",sum);
}
0