結果

問題 No.884 Eat and Add
ユーザー MayimgMayimg
提出日時 2019-09-13 21:41:17
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 1,858 ms
コンパイル使用メモリ 198,996 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 07:03:42
合計ジャッジ時間 2,680 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 WA -
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  string s;
  cin >> s;
  int ans = 0, seq = 0;
  s.push_back('0');
  for (char c : s) {
    if (c == '1') {
      seq++;
    } else {
      if (seq > 2) ans += 2;
      else if (seq) ans += 1;
      seq = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
0