結果

問題 No.2385 Parse Integer with Radix
ユーザー komkompikomkompi
提出日時 2023-07-21 21:38:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 406 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 11,828 KB
実行使用メモリ 42,160 KB
最終ジャッジ日時 2023-10-21 21:34:13
合計ジャッジ時間 7,591 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 391 ms
42,160 KB
testcase_01 AC 395 ms
42,160 KB
testcase_02 AC 391 ms
42,160 KB
testcase_03 AC 390 ms
42,160 KB
testcase_04 AC 397 ms
42,160 KB
testcase_05 AC 386 ms
42,160 KB
testcase_06 AC 395 ms
42,160 KB
testcase_07 AC 394 ms
42,160 KB
testcase_08 AC 403 ms
42,160 KB
testcase_09 AC 395 ms
42,160 KB
testcase_10 AC 406 ms
42,160 KB
testcase_11 AC 401 ms
42,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# Your code here!
import numpy as np

Q=int(input())


for _ in range(Q):
    S=input()
    
    encode,num=S[:2],S[2:]
    
    if encode=="0b":
        ans=int(num,2)
        
    elif encode=="0o":
        ans=int(num,8)
        
    elif encode=="0x":
        ans=int(num,16)
    else:
        ans=S
    
    print(ans)
        
0