본문 바로가기
알고리즘/백준

[BAEKJOON] 22193 Multiply

by 응애~ 개발자 2022. 11. 28.
728x90
반응형

문제 요약

 

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