結果
問題 |
No.3276 Make Smaller Popcount
|
ユーザー |
|
提出日時 | 2025-09-23 00:32:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 639 ms / 2,000 ms |
コード長 | 327 bytes |
コンパイル時間 | 378 ms |
コンパイル使用メモリ | 82,372 KB |
実行使用メモリ | 77,728 KB |
最終ジャッジ日時 | 2025-09-23 00:33:17 |
合計ジャッジ時間 | 21,289 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 28 |
ソースコード
def solve(): n = int(input()) ni = n pc = 0 x = 0 for i in range(31): if ni%2 == 1: pc += 1 if pc == 1: x += 2**i else: if pc == 1: x += 2**i elif pc > 1: break ni //= 2 else: return -1 return x t = int(input()) for i in range(t): print(solve())