본문 바로가기
python-algorithm

백준 16428 A/B - 3

by 무적김두칠 2022. 12. 28.

https://www.acmicpc.net/problem/16428

 

16428번: A/B - 3

첫째 줄에 A와 B가 주어진다. (-1010000 ≤ A, B ≤ 1010000, B ≠ 0)

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
def sol(a, b):
    if b <=0:
        return -(a//(-b)), a%(-b)
    else:
        return a//b, a%b
 
if __name__ == '__main__':
    a, b =map(int,input().split())
    q ,r =sol(a,b)
    print(q)
    print(r)
cs
반응형

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

백준 26004 HI-ARC  (0) 2022.12.28
백준 10698 Ahmed Aly  (0) 2022.12.28
백준 4806 줄 세기  (0) 2022.12.26
백준 17094 Serious Problem  (0) 2022.12.26
백준 17010 Time to Decompress  (0) 2022.12.26

댓글