結果
問題 | No.929 よくあるボールを移動するやつ |
ユーザー |
![]() |
提出日時 | 2020-01-14 20:57:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 274 bytes |
コンパイル時間 | 792 ms |
コンパイル使用メモリ | 72,816 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 09:34:39 |
合計ジャッジ時間 | 1,898 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 |
ソースコード
#include <cmath>#include <vector>#include <iostream>using namespace std;int main() {int n; cin >> n;long long ans = 0;for (int i = 0, c = 0; i < n; i++) {int b; cin >> b;while (b--) ans += abs(i-c), c++;}cout << ans << endl;}