結果

問題 No.782 マイナス進数
ユーザー ayaoniayaoni
提出日時 2020-12-08 14:09:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 783 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 75,828 KB
最終ジャッジ日時 2023-10-17 17:12:54
合計ジャッジ時間 5,722 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,528 KB
testcase_01 AC 36 ms
53,528 KB
testcase_02 AC 60 ms
72,768 KB
testcase_03 AC 60 ms
72,804 KB
testcase_04 AC 63 ms
74,036 KB
testcase_05 AC 68 ms
72,768 KB
testcase_06 AC 76 ms
72,768 KB
testcase_07 AC 74 ms
75,740 KB
testcase_08 AC 62 ms
72,768 KB
testcase_09 AC 65 ms
72,756 KB
testcase_10 AC 61 ms
72,756 KB
testcase_11 AC 71 ms
75,828 KB
testcase_12 AC 68 ms
75,760 KB
testcase_13 AC 81 ms
75,740 KB
testcase_14 AC 69 ms
75,764 KB
testcase_15 AC 71 ms
75,828 KB
testcase_16 AC 69 ms
75,760 KB
testcase_17 AC 74 ms
75,728 KB
testcase_18 AC 68 ms
75,760 KB
testcase_19 AC 72 ms
75,756 KB
testcase_20 AC 68 ms
75,716 KB
testcase_21 AC 75 ms
75,752 KB
testcase_22 AC 68 ms
75,756 KB
testcase_23 AC 63 ms
74,316 KB
testcase_24 AC 82 ms
75,756 KB
testcase_25 AC 68 ms
75,760 KB
testcase_26 AC 71 ms
75,744 KB
testcase_27 AC 71 ms
75,732 KB
testcase_28 AC 68 ms
75,740 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


T,B = MI()
B = -B

for _ in range(T):
    N = I()
    b = 0
    ANS = []
    while N:
        if b == 0:
            r = N % B
            N //= B
            ANS.append(str(r))
        else:
            r = (-N) % B
            N = (N+r)//B
            ANS.append(str(r))
        b = 1-b
    ANS.reverse()
    print(''.join(ANS))
0