結果
問題 |
No.3015 右に寄せろ!
|
ユーザー |
|
提出日時 | 2025-03-22 00:10:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 325 ms / 2,000 ms |
コード長 | 461 bytes |
コンパイル時間 | 447 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 252,276 KB |
最終ジャッジ日時 | 2025-03-22 00:10:32 |
合計ジャッジ時間 | 6,489 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 36 |
ソースコード
S=list(map(int, input())) res=[] row=[] row.append(S[0]) for i in range(1, len(S)): if S[i] == S[i-1]: row.append(S[i]) else: res.append(row) row=[S[i]] res.append(row) count=0 ans=0 p=0 for num,i in enumerate(res): if i[0] == 1: count += len(i) else: if count == 1: count=0 continue if count%2 == 0: ans += (count//2)*len(i) else: ans += (count//2)*len(i) count -= 1 print(ans)