본문 바로가기
python-algorithm

[백준] 4328

by 무적김두칠 2021. 2. 26.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import sys
def tmodecimal(tmp, b):
    ans=''
    while tmp>=b:
        ans+=str(tmp%b)
        tmp//=b
    ans+=str(tmp)
    return ans[::-1]
while 1:
    n=input()
    if n=='0': break
    b,tmp1,tmp2=n.split()
    tmp1=int(tmp1,int(b))
    tmp2 = int(tmp2, int(b))
    print(tmodecimal(tmp1%tmp2,int(b)))
cs
반응형

'python-algorithm' 카테고리의 다른 글

[백준] 2914  (0) 2021.03.03
[백준] 1417  (0) 2021.03.02
[백준] 4299  (0) 2021.02.26
[백준] 3943  (0) 2021.02.26
[백준] 2997  (0) 2021.02.26

댓글