結果

問題 No.1298 OR XOR
ユーザー 8wings648wings64
提出日時 2020-11-27 21:30:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 78 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 1,186 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 71,396 KB
最終ジャッジ日時 2023-10-01 04:50:11
合計ジャッジ時間 2,907 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,220 KB
testcase_01 AC 73 ms
71,380 KB
testcase_02 AC 72 ms
71,376 KB
testcase_03 AC 78 ms
71,136 KB
testcase_04 AC 72 ms
71,208 KB
testcase_05 AC 72 ms
71,000 KB
testcase_06 AC 72 ms
71,340 KB
testcase_07 AC 72 ms
71,268 KB
testcase_08 AC 71 ms
70,992 KB
testcase_09 AC 73 ms
71,280 KB
testcase_10 AC 70 ms
71,132 KB
testcase_11 AC 73 ms
71,396 KB
testcase_12 AC 72 ms
71,128 KB
testcase_13 AC 72 ms
71,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
n_two = []
while n>1:
    n_two.append(n%2)
    n//=2
n_two.append(1)        
if sum(n_two) <= 1:
    exit(print(-1,-1,-1))

a_list = [0]*len(n_two)
b_list = [0]*len(n_two)
c_list = [0]*len(n_two)
check = 0
for i in range(len(n_two)):
    if n_two[i] == 1:
        check += 1
        if check%3 == 1:
            a_list[i] = 1
            b_list[i] = 1
        else:
            a_list[i] = 1
            c_list[i] = 1

def ans(x):
    a = 0
    for i in range(len(x)):
        a += x[i]*(2**i)
    return a
print(ans(a_list),ans(b_list),ans(c_list))
0