結果

問題 No.782 マイナス進数
ユーザー rlangevinrlangevin
提出日時 2023-02-06 12:48:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 431 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 78,536 KB
最終ジャッジ日時 2023-09-18 00:37:21
合計ジャッジ時間 7,729 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,160 KB
testcase_01 AC 75 ms
71,304 KB
testcase_02 AC 167 ms
78,020 KB
testcase_03 AC 139 ms
77,892 KB
testcase_04 AC 148 ms
78,536 KB
testcase_05 AC 138 ms
77,472 KB
testcase_06 AC 148 ms
78,236 KB
testcase_07 AC 154 ms
78,192 KB
testcase_08 AC 139 ms
77,188 KB
testcase_09 AC 143 ms
77,424 KB
testcase_10 AC 138 ms
77,020 KB
testcase_11 AC 144 ms
77,432 KB
testcase_12 AC 153 ms
78,304 KB
testcase_13 AC 162 ms
77,484 KB
testcase_14 AC 156 ms
78,272 KB
testcase_15 AC 143 ms
77,392 KB
testcase_16 AC 150 ms
78,272 KB
testcase_17 AC 156 ms
77,808 KB
testcase_18 AC 155 ms
78,268 KB
testcase_19 AC 148 ms
77,416 KB
testcase_20 AC 143 ms
77,472 KB
testcase_21 AC 154 ms
77,452 KB
testcase_22 AC 142 ms
77,420 KB
testcase_23 AC 140 ms
77,416 KB
testcase_24 AC 168 ms
77,552 KB
testcase_25 AC 142 ms
77,372 KB
testcase_26 AC 148 ms
77,232 KB
testcase_27 AC 152 ms
78,252 KB
testcase_28 AC 141 ms
77,436 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 #

T, B = map(int, input().split())
B = -B
for _ in range(T):
    N = int(input())
    cnt = 0
    ans = []
    while N:
        v = N % B
        # print(cnt, v, N)
        if cnt % 2:
            if v:
                ans.append(B - v)
                N += B
            else:
                ans.append(0)
        else:
            ans.append(v)
        N //= B
        cnt += 1
        
    ans = ans[::-1]
    print(*ans, sep="")
0