結果
問題 | No.929 よくあるボールを移動するやつ |
ユーザー |
|
提出日時 | 2019-11-22 21:45:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 179 bytes |
コンパイル時間 | 521 ms |
コンパイル使用メモリ | 62,464 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 03:12:08 |
合計ジャッジ時間 | 1,373 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 12 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int N,B; main() { cin>>N; long now=0,ans=0; for(int i=0;i<N;i++) { cin>>B; now+=B-1; ans+=now<0?-now:now; } cout<<ans<<endl; }