728x90
반응형
문제 요약
- 알고리즘 분류: 수학
- 난이도: Bronze5
- 문제내용:
- N M 길이 준다 A , B 곱한 결과를 출력해라
- 사이트: https://www.acmicpc.net/problem/22193
22193번: Multiply
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.
www.acmicpc.net
Code
Python
input()
print(int(input()) * int(input()))
Java
정수의 길이의 제한이 없어서 BigInteger로 선언해야 된다.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
br.readLine();
BigInteger N = new BigInteger(br.readLine());
System.out.println(N.multiply(new BigInteger(br.readLine())));
}
}
728x90
반응형
'알고리즘 > 백준' 카테고리의 다른 글
[BAEKJOON] 1092 배 (0) | 2022.12.06 |
---|---|
[BAEKJOON] 12015 가장 긴 증가하는 부분 수열 2 (2) | 2022.11.29 |
[BAEKJOON] 1300 K번째 수 (0) | 2022.11.28 |
[BAEKJOON] 2012 등수 매기기 (0) | 2022.11.28 |
[BAEKJOON] 6549 히스토그램에서 가장 큰 직사각형 (0) | 2022.11.25 |