結果
| 問題 |
No.1452 XOR×OR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-05-03 13:55:33 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 528 bytes |
| コンパイル時間 | 168 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-22 04:10:29 |
| 合計ジャッジ時間 | 2,732 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
def popcount(x):
x = x - ((x >> 1) & 0x55555555)
# 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
x = (x + (x >> 4)) & 0x0f0f0f0f # 8bitごと
x = x + (x >> 8) # 16bitごと
x = x + (x >> 16) # 32bitごと
return x & 0x0000007f
N = int(input())
i = 1
cnt = 0
while i**2 <= N:
if N % i == 0:
AXB = i
AOB = N // i
if (~AOB & AXB) == 0:
cnt += 2**(popcount(AOB&AXB)-1)
i += 1
print(cnt)