結果

問題 No.929 よくあるボールを移動するやつ
ユーザー queee
提出日時 2019-11-22 22:23:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 252 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 54,136 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-11 04:05:14
合計ジャッジ時間 1,251 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 9 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main() {
  int n; cin >> n; int b[n];
  for(int i=0; i<n; i++) cin >> b[i];
  int nw = 0, nw_cost = 0;
  for(int i=0; i<n; i++) {
    nw += b[i] - 1;
    nw_cost += abs(nw);
  }
  cout << nw_cost << endl;
}
0