結果

問題 No.1871 divisXor
ユーザー gew1fw
提出日時 2025-06-12 14:12:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 982 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 82,676 KB
実行使用メモリ 54,268 KB
最終ジャッジ日時 2025-06-12 14:13:02
合計ジャッジ時間 6,622 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 3 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

if n == 0:
    print(-1)
else:
    # Check if n can be represented as f(x) for some x
    found = False
    for x in [1, 3, 7, 31, 2, 6, 12, 8, 28, 4, 15, 24, 16, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767]:
        # Compute f(x)
        if x == 1:
            f = 1
        elif x == 2:
            f = 3
        elif x == 3:
            f = 4
        elif x == 4:
            f = 7
        elif x == 6:
            f = 12
        elif x == 7:
            f = 8
        elif x == 8:
            f = 15
        elif x == 12:
            f = 28
        elif x == 15:
            f = 24
        elif x == 16:
            f = 31
        elif x == 24:
            f = 60
        elif x == 28:
            f = 56
        elif x == 31:
            f = 32
        else:
            continue
        if f == n:
            print(1)
            print(x)
            found = True
            break
    if not found:
        print(3)
        print('1 6 12')
0