結果
問題 | No.275 中央値を求めよ |
ユーザー |
![]() |
提出日時 | 2018-07-09 13:59:20 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 369 bytes |
コンパイル時間 | 232 ms |
コンパイル使用メモリ | 30,080 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 01:51:27 |
合計ジャッジ時間 | 1,495 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
ソースコード
#include<stdio.h> int main() { int N; int A[1000]; int i,j,tmp; scanf("%d",&N); for(i=0;i<N;i++) scanf("%d",&A[i]); for(i=0;i<N;i++){ for(j=i+1;j<N;j++){ if(A[i]>A[j]){ tmp=A[i]; A[i]=A[j]; A[j]=tmp; } } } if(N%2==0) printf("%lf",(double)(A[N/2-1]+A[N/2])/2); else printf("%d",A[N/2]); return 0; }