結果

問題 No.782 マイナス進数
ユーザー Mcpu3Mcpu3
提出日時 2020-04-05 10:58:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 384 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 836 ms
コンパイル使用メモリ 10,504 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2023-09-16 06:32:03
合計ジャッジ時間 7,434 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,484 KB
testcase_01 AC 19 ms
8,480 KB
testcase_02 AC 125 ms
8,456 KB
testcase_03 AC 143 ms
8,532 KB
testcase_04 AC 160 ms
8,428 KB
testcase_05 AC 130 ms
8,396 KB
testcase_06 AC 124 ms
8,488 KB
testcase_07 AC 211 ms
8,480 KB
testcase_08 AC 140 ms
8,448 KB
testcase_09 AC 127 ms
8,428 KB
testcase_10 AC 124 ms
8,560 KB
testcase_11 AC 207 ms
8,388 KB
testcase_12 AC 183 ms
8,444 KB
testcase_13 AC 384 ms
8,484 KB
testcase_14 AC 192 ms
8,532 KB
testcase_15 AC 211 ms
8,492 KB
testcase_16 AC 190 ms
8,428 KB
testcase_17 AC 287 ms
8,532 KB
testcase_18 AC 191 ms
8,464 KB
testcase_19 AC 246 ms
8,608 KB
testcase_20 AC 188 ms
8,452 KB
testcase_21 AC 267 ms
8,512 KB
testcase_22 AC 203 ms
8,604 KB
testcase_23 AC 170 ms
8,428 KB
testcase_24 AC 375 ms
8,456 KB
testcase_25 AC 190 ms
8,492 KB
testcase_26 AC 229 ms
8,528 KB
testcase_27 AC 209 ms
8,444 KB
testcase_28 AC 181 ms
8,564 KB
testcase_29 AC 19 ms
8,480 KB
testcase_30 AC 19 ms
8,416 KB
testcase_31 AC 19 ms
8,428 KB
testcase_32 AC 20 ms
8,444 KB
testcase_33 AC 19 ms
8,492 KB
testcase_34 AC 19 ms
8,428 KB
testcase_35 AC 19 ms
8,460 KB
testcase_36 AC 19 ms
8,556 KB
testcase_37 AC 19 ms
8,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections

T, B = map(int, input().split())
for i in range(T):
	N = int(input())
	a = collections.deque()
	while True:
		if N % B < 0:
			a.appendleft(N % B - B)
			N += B
		else:
			a.appendleft(N % B)
		N //= B
		if not N:
			break
	for j in a:
		print(j, end='')
	print()
0