python-algorithm

백준 16428 A/B - 3

무적김두칠 2022. 12. 28. 16:29

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
반응형