結果

問題 No.3088 XOR = SUM
ユーザー titia
提出日時 2025-05-07 04:44:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 462 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,568 KB
最終ジャッジ日時 2025-05-07 04:44:44
合計ジャッジ時間 21,294 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T=int(input())
for tests in range(T):
    N=int(input())

    ANS1=0
    ANS2=0

    ANS3=0
    ANS4=0

    x=0

    for i in range(63,-1,-1):
        if N & (1<<i) != 0:
            if x==0:
                ANS1+=1<<i
                if i>=1:
                    ANS3=(1<<(i-1))
            else:
                ANS2+=1<<i
            x=1

    ANS4=ANS3-1

    if ANS1*ANS2>=ANS3*ANS4:
        print(ANS1,ANS2)
    else:
        print(ANS3,ANS4)


0