結果

問題 No.1298 OR XOR
ユーザー kept1994kept1994
提出日時 2021-08-28 00:36:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 1,016 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 54,372 KB
最終ジャッジ日時 2024-05-01 05:30:08
合計ジャッジ時間 1,818 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,716 KB
testcase_01 AC 36 ms
53,336 KB
testcase_02 AC 35 ms
53,088 KB
testcase_03 AC 35 ms
53,028 KB
testcase_04 AC 35 ms
53,468 KB
testcase_05 AC 35 ms
52,544 KB
testcase_06 AC 35 ms
52,504 KB
testcase_07 AC 36 ms
53,012 KB
testcase_08 AC 34 ms
53,200 KB
testcase_09 AC 35 ms
53,988 KB
testcase_10 AC 35 ms
54,372 KB
testcase_11 AC 34 ms
52,784 KB
testcase_12 AC 34 ms
53,732 KB
testcase_13 AC 34 ms
52,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys


def main():
    import math
    N = int(input())
    S = bin(N)[2:]
    d = len(S)
    if math.log2(N).is_integer():
        print(-1, -1, -1)
        return
    A = []
    B = []
    C = []
    for ss in S:
        if ss == "0":
            A.append("0")
            B.append("0")
            C.append("0")
        else:
            if len(C) == 0:
                A.append("1")
                B.append("0")
                C.append("1")
            else:
                A.append("1")
                B.append("1")
                C.append("0")
    print(int("".join(A), 2), int("".join(B), 2), int("".join(C), 2))
    # for a in range(1, N + 1):
    #     for b in range(1, N + 1):
    #         for c in range(1, N + 1):
    #             if a | b == b | c == c | a == N and a ^ b ^ c == 0:
    #                 print(bin(a))
    #                 print(bin(b))
    #                 print(bin(c))
    #                 print(a, b, c)


if __name__ == '__main__':
    main()
0