結果
問題 | No.275 中央値を求めよ |
ユーザー |
|
提出日時 | 2016-10-30 12:45:04 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 159 bytes |
コンパイル時間 | 1,575 ms |
コンパイル使用メモリ | 168,568 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 00:07:22 |
合計ジャッジ時間 | 2,685 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | main(){int n,i=0,a[1000];std::cin>>n;for(;n-i;)std::cin>>a[i++];std::sort(a,a+n);printf("%.2f\n",n%2?a[n/2]:float(a[n/2]+a[n/2-1])/2);} | ^~~~
ソースコード
#include<bits/stdc++.h>main(){int n,i=0,a[1000];std::cin>>n;for(;n-i;)std::cin>>a[i++];std::sort(a,a+n);printf("%.2f\n",n%2?a[n/2]:float(a[n/2]+a[n/2-1])/2);}