結果

問題 No.198 キャンディー・ボックス2
ユーザー itezpace
提出日時 2016-09-16 07:33:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 352 bytes
コンパイル時間 505 ms
コンパイル使用メモリ 54,360 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 06:25:10
合計ジャッジ時間 1,225 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;
int main(){
  ll b,n,c;
  cin>>b;
  cin>>n;
  ll ary[n];
  ll d=0;
  for(ll i=0; i<n; ++i){
    cin>>c;
    ary[i]=c;
    d+=c;
  }
  ll e=d/n;
  if(n>1){
    (d+b)/n;
  }
  ll f=0;
  for(ll i=0; i<n; ++i){
    ll g=e-ary[i];
    if(g<0) g*=-1;
    f+=g;
  }
  cout<<f<<endl;
  return 0;
}
0