結果
| 問題 | No.3015 右に寄せろ! |
| コンテスト | |
| ユーザー |
麻崎 系
|
| 提出日時 | 2026-11-14 08:42:08 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 610 bytes |
| 記録 | |
| コンパイル時間 | 3,036 ms |
| コンパイル使用メモリ | 353,400 KB |
| 実行使用メモリ | 9,924 KB |
| 最終ジャッジ日時 | 2026-11-14 08:42:16 |
| 合計ジャッジ時間 | 6,197 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 WA * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
int n = S.size();
int most_right_zero = 0;
for (int i = n - 1; i >= 0; i--) {
if (S.at(i) == '0') {
most_right_zero = i;
break;
}
}
int ans = 0;
bool plus = true;
for (int i = 0; i < n - 2; i++) {
if (S.at(i) == '1' && S.at(i+1) == '1' && S.at(i+2) == '0') {
if (plus) {ans += most_right_zero - (i + 1);}
else {ans -= most_right_zero - (i + 1);}
plus = !plus;
}
}
cout << ans << endl;
}
麻崎 系