結果
| 問題 | No.782 マイナス進数 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-11 21:26:48 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 147 ms / 2,000 ms |
| コード長 | 445 bytes |
| 記録 | |
| コンパイル時間 | 131 ms |
| コンパイル使用メモリ | 77,612 KB |
| 最終ジャッジ日時 | 2025-12-04 01:29:38 |
|
ジャッジサーバーID (参考情報) |
judge4 / 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