結果
問題 | No.609 Noelちゃんと星々 |
ユーザー |
|
提出日時 | 2019-08-19 02:24:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 64 ms / 2,000 ms |
コード長 | 261 bytes |
コンパイル時間 | 2,296 ms |
コンパイル使用メモリ | 195,796 KB |
最終ジャッジ日時 | 2025-01-07 14:15:27 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;int main() {int n;cin>>n;int a[n];for (int i=0;i<n;i++) cin>>a[i];sort(a,a+n);ll ans=0;for (int x:a) ans+=abs(x-a[n/2]);cout<<ans<<endl;return 0;}