結果
問題 | No.609 Noelちゃんと星々 |
ユーザー |
|
提出日時 | 2017-12-11 10:27:39 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 322 bytes |
コンパイル時間 | 769 ms |
コンパイル使用メモリ | 108,572 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 22:58:21 |
合計ジャッジ時間 | 2,465 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import std.algorithm, std.conv, std.range, std.stdio, std.string;import std.math; // math functionsvoid main(){auto n = readln.chomp.to!int;auto y = readln.split.to!(int[]);y.sort();auto m = n&1 ? y[n/2] : (y[n/2-1]+y[n/2])/2;auto ans = 0L;foreach (yi; y) ans += (yi-m).abs;writeln(ans);}