結果
| 問題 |
No.782 マイナス進数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-11 21:26:48 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 2,000 ms |
| コード長 | 445 bytes |
| コンパイル時間 | 581 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2024-11-30 03:03:35 |
| 合計ジャッジ時間 | 3,625 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
import string
def int2negbase(num, base, digits=string.digits+string.ascii_uppercase):
assert base < -1
num = -num
if num == 0:
return digits[0]
s = ''
while num != 0:
s = digits[-(num % base)] + s
num /= base
return s
T, B = map(int, raw_input().split())
for loop in xrange(T):
N = int(raw_input())
res = int2negbase(N, B)
print res