結果
| 問題 |
No.381 名声値を稼ごう Extra
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:43:31 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 891 bytes |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 82,180 KB |
| 実行使用メモリ | 52,480 KB |
| 最終ジャッジ日時 | 2025-06-12 14:43:41 |
| 合計ジャッジ時間 | 10,263 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 TLE * 1 |
ソースコード
def divide_by_two(n_str):
if n_str == '0':
return '0'
carry = 0
result = []
for c in n_str:
current = carry * 10 + int(c)
quotient = current // 2
remainder = current % 2
carry = remainder
result.append(str(quotient))
# Remove leading zeros
while len(result) > 1 and result[0] == '0':
result.pop(0)
return ''.join(result)
def decimal_to_binary(n_str):
if n_str == '0':
return '0'
binary = ''
while n_str != '0':
mod = int(n_str[-1]) % 2
binary = str(mod) + binary
n_str = divide_by_two(n_str)
return binary
def count_set_bits(n_str):
binary_str = decimal_to_binary(n_str)
return binary_str.count('1')
def main():
MOD = 1004535809
N = input().strip()
count = count_set_bits(N)
print(count % MOD)
if __name__ == "__main__":
main()
gew1fw