반응형
https://www.acmicpc.net/problem/6974
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
몫과 나머지를 출력하는 문제였습니다.
📕 풀이방법
📔 입력 및 초기화
test case n을 입력해줍니다.
📔 풀이과정
python은 큰 수에 대한 사칙연산을 제공합니다. 따라서 단순히 답을 구하면 됩니다.
📔 정답출력
몫과 나머지를 출력하기만 하면 됩니다.
📕 Code
n = int(input())
for i in range(n):
a = int(input())
b = int(input())
print(a // b)
print(a % b)
print()
'Algorithm > Implementation' 카테고리의 다른 글
(Python) - 백준(BOJ) 6976 : Divisibility by 11 (0) | 2022.01.07 |
---|---|
(C++) - 백준(BOJ) 15751 : Teleportation (0) | 2022.01.06 |
(C++) - 백준(BOJ) 6794 : What is n, Daddy? (0) | 2022.01.02 |
(C++) - 백준(BOJ) 23971 : ZOAC 4 (0) | 2022.01.01 |
(C++) - 백준(BOJ) 6780 : Sumac Sequences (0) | 2021.12.30 |