結果
| 問題 | No.3015 右に寄せろ! |
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2025-01-28 15:59:09 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 666 bytes |
| 記録 | |
| コンパイル時間 | 442 ms |
| コンパイル使用メモリ | 53,044 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-25 17:10:34 |
| 合計ジャッジ時間 | 4,342 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 RE * 11 |
ソースコード
/* -*- coding: utf-8 -*-
*
* 3015.cc: No.3015 蜿ウ縺ォ蟇・○繧・ - yukicoder
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
/* constant */
const int MAX_N = 200000;
/* typedef */
using ll = long long;
/* global variables */
char s[MAX_N + 4];
/* subroutines */
/* main */
int main() {
scanf("%s", s);
int n = strlen(s);
ll sum = 0;
for (int i = 0, x = 0; i < n;) {
int l1 = 0, l0 = 0;
while (i < n && s[i] == '1') i++, l1++;
while (i < n && s[i] == '0') i++, l0++;
if (l0 > 0 && l1 > 0) {
x += l1 / 2;
sum += (ll)x * l0;
}
}
printf("%lld\n", sum);
return 0;
}
tnakao0123