結果
問題 | No.884 Eat and Add |
ユーザー |
|
提出日時 | 2019-09-13 21:41:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 386 bytes |
コンパイル時間 | 1,636 ms |
コンパイル使用メモリ | 193,320 KB |
最終ジャッジ日時 | 2025-01-07 17:47:07 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 5 |
ソースコード
#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; }