結果
問題 |
No.3015 右に寄せろ!
|
ユーザー |
![]() |
提出日時 | 2024-11-19 03:59:54 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 349 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 158,340 KB |
最終ジャッジ日時 | 2025-01-25 21:52:42 |
合計ジャッジ時間 | 4,570 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 RE * 18 |
ソースコード
S = '0' + input() + '*' cnts = {} l = 0 cnt = 1 for i in range(len(S) - 1): if S[i] != S[i + 1]: cnts[l] = cnt cnt = 1 l += 1 else: cnt += 1 ans = 0 for i in range(l): if i % 2 == 0: continue ans += (cnts[i] // 2) * cnts[i + 1] if i + 2 < l: cnts[i + 2] += (cnts[i] // 2) * 2 print(ans)