[파이썬][백준 22193번] Multiply
1. 문제Permalink
[Bronze V] Multiply - 22193Permalink
성능 요약Permalink
메모리: 30864 KB, 시간: 180 ms
분류Permalink
임의 정밀도 / 큰 수 연산(arbitrary_precision), 사칙연산(arithmetic), 수학(math)
문제 설명Permalink
Write a program that computes a product of two non-negative integers A and B. The integers are represented in decimal notation and have N and M digits, respectively.
입력Permalink
The first line contains the lengths N and M, separated by a space. A is given on the second and B on the third line. The numbers will not have leading zeros.
출력Permalink
Output the product of A and B without leading zeros.
출처: 백준, https://https://www.acmicpc.net/
2. 해결방법 시간복잡도Permalink
- 단순 코딩 O(1)
3. 문제 해결 및 코드Permalink
N, M = map(int, input().split()) | |
A = int(input()) | |
B = int(input()) | |
print(A * B) |
-
주석을 참고하면서 이해를 돕습니다.Permalink
4. 알고리즘 및 해설Permalink
- 문제에서 음이 아닌 두 정수를 곱하라고 하였다.
- 그러므로 N과 M의 자리를 가지나 백준에서는 해당 값을 구분한 한뒤 최종적으로 사용하지는 않는 듯하다.
- 최종적으로 A 와 B 정수를 곱해서 출력해준다.