結果
| 問題 |
No.381 名声値を稼ごう Extra
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 12:53:40 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 458 bytes |
| コンパイル時間 | 282 ms |
| コンパイル使用メモリ | 82,180 KB |
| 実行使用メモリ | 70,612 KB |
| 最終ジャッジ日時 | 2025-06-12 12:56:19 |
| 合計ジャッジ時間 | 704 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 RE * 1 |
ソースコード
n_str = input().strip()
n = int(n_str)
binary = bin(n)[2:] # Convert to binary and remove '0b' prefix
L = len(binary)
prefix = [0] * (L + 1)
# Compute prefix sums of 1s in the binary string
for i in range(L):
prefix[i+1] = prefix[i] + (1 if binary[i] == '1' else 0)
max_s = 0
# Check all possible shifts (m) from 0 to L-1
for m in range(L):
current = prefix[L] - prefix[m]
if current > max_s:
max_s = current
print(max_s % 1004535809)
gew1fw