結果
| 問題 | No.3088 XOR = SUM | 
| コンテスト | |
| ユーザー |  timi | 
| 提出日時 | 2025-04-05 01:16:08 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 979 ms / 2,000 ms | 
| コード長 | 438 bytes | 
| コンパイル時間 | 636 ms | 
| コンパイル使用メモリ | 82,048 KB | 
| 実行使用メモリ | 77,696 KB | 
| 最終ジャッジ日時 | 2025-04-05 01:16:41 | 
| 合計ジャッジ時間 | 30,926 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 22 | 
ソースコード
T=int(input())
for i in range(T):
  N=int(input())
  if N==0:
    print(0,0)
  else:
    c=bin(N)[2:]
    x,y=-1,-1;z=-1
    for i in range(len(c)):
      if c[i]=='1':
        i=len(c)-1-i
        p=pow(2,i)
        xx,yy=p,N-p 
        if z<xx*yy:
          z=xx*yy 
          x,y=xx,yy 
        p=pow(2,i)-1 
        xx=pow(2,i-1)
        yy=p-xx
        if z<xx*yy:
          z=xx*yy 
          x,y=xx,yy 
        break
    print(x,y)
            
            
            
        