結果

問題 No.3102 floor sqrt xor
ユーザー yz
提出日時 2025-04-12 08:48:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 304 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 82,576 KB
実行使用メモリ 61,736 KB
最終ジャッジ日時 2025-04-12 08:48:14
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
for _ in range(int(input())):
    N=int(input())
    if N==0:
        print(0)
        continue
    m0=math.isqrt(N)
    for m in[m0-1,m0,m0+1]:
        if m<0:
            continue
        k=m^N
        if math.isqrt(k)==m:
            print(k)
            break
    else:
        print(-1)
0