• Home
  • About
    • JOOS photo

      JOOS

      Joos's blog

    • Learn More
    • Email
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

[백준] 2745번 : 진법 변환 with python3

26 Sep 2018

Reading time ~1 minute

문제: https://www.acmicpc.net/problem/2745

import sys

read = lambda : sys.stdin.readline().strip()
n, b = read().split(' ')

ans = 0
for i in n:
    ans *= int(b)
    if i < 'A':
        ans += int(i)
    else:
        ans += int(ord(i))-55
print(ans)


algorithm백준 Share Tweet +1