結果

問題 No.2385 Parse Integer with Radix
ユーザー rlangevin
提出日時 2023-07-21 21:25:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-09-21 22:39:26
合計ジャッジ時間 1,267 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

Q = int(input())
for _ in range(Q):
    N = input().rstrip()
    if len(N) <= 2:
        print(N)
        continue
    if 0 <= ord(N[1]) - ord("0") <= 9:
        print(N)
        continue
    if N[1] == "b":
        print(int(N[2:], 2))
    elif N[1] == "o":
        print(int(N[2:], 8))
    else:
        print(int(N[2:], 16))
0