結果

問題 No.3088 XOR = SUM
ユーザー ルク
提出日時 2025-08-31 22:03:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 928 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 540 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,048 KB
最終ジャッジ日時 2025-08-31 22:03:45
合計ジャッジ時間 30,319 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    if n == 0:
        print(0, 0)
        continue
    mx = 0
    for i in range(100):
        if 2**mx*2 <= n:
            mx += 1
        else:
            break
    s1 = 2**mx
    s2 = n-s1
    s3 = 2**(mx-1)
    s4 = 2**(mx-1)-1
    ans1 = s1*s2
    ans2 = s3*s4
    if ans1 > ans2:
        print(s1, s2)
    else:
        print(s3, s4)
0