結果
| 問題 |
No.1452 XOR×OR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-06-05 09:47:47 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 436 bytes |
| コンパイル時間 | 228 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-21 04:04:28 |
| 合計ジャッジ時間 | 2,611 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
from math import isqrt
def calc(x, y):
res = 1
if x | y != y:
return 0
for i in range(32):
xi = (x >> i) & 1
yi = (y >> i) & 1
if xi & yi:
res *= 2
return res
N = int(input())
ans = 0
for x in range(1, isqrt(N) + 1):
if N % x:
continue
y = N // x
ans += calc(x, y)
if x != y:
ans += calc(y, x)
ans //= 2 # 順序区別しない
print(ans)