백준 13877번: 이건 무슨 진법이지? #Python

ColorlessDia·2025년 1월 12일

algorithm/baekjoon

목록 보기
420/836
import sys

T = int(sys.stdin.readline())

for _ in range(T):
    K, N = sys.stdin.readline().rstrip().split()

    octal = int(N, 8) if max(map(int, N)) < 8 else 0
    decimal = int(N)
    hexadecimal = int(N, 16)
    
    print(f'{K} {octal} {decimal} {hexadecimal}')

0개의 댓글