結果

問題 No.1298 OR XOR
ユーザー 8wings64
提出日時 2020-11-27 21:30:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 439 ms
コンパイル使用メモリ 82,384 KB
実行使用メモリ 53,816 KB
最終ジャッジ日時 2024-07-23 22:10:40
合計ジャッジ時間 1,659 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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