728x90
6974번: Long Division
In days of yore (circa 1965), mechanical calculators performed division by shifting and repeated subtraction. For example, to divide 987654321 by 3456789, the numbers would first be aligned by their leftmost digit (see (1) below), and the divisor subtracte
www.acmicpc.net
문제 풀이
이 문제는 몫과 나머지를 구해서 출력하는 문제이다. 파이썬에서는 큰 수 연산을 지원하기 때문에 아주 간단하게 문제를 풀 수 있다.
정답 코드
for _ in range(int(input())) :
a = int(input())
b = int(input())
print(a // b)
print(a % b)
print()
728x90
'Algorithm > PS' 카테고리의 다른 글
[BOJ/백준] 7510 - 고급 수학 [python] (1) | 2023.03.20 |
---|---|
[BOJ/백준] 6975 - Deficient, Perfect, and Abundant [python] (0) | 2023.03.20 |
[BOJ/백준] 6903 - Trident [python] (0) | 2023.03.19 |
[BOJ/백준] 6889 - Smile with Similes [python] (1) | 2023.03.19 |
[BOJ/백준] 6845 - Federal Voting Age [python] (0) | 2023.03.19 |