본문 바로가기
PS/백준

백준 - 곱셈 (2588번)

by 종안이 2023. 10. 7.

곱셈 성공

 
 
시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB 341604 160972 134973 47.261%

문제

(세 자리 수) × (세 자리 수)는 다음과 같은 과정을 통하여 이루어진다.

(1)과 (2)위치에 들어갈 세 자리 자연수가 주어질 때 (3), (4), (5), (6)위치에 들어갈 값을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 (1)의 위치에 들어갈 세 자리 자연수가, 둘째 줄에 (2)의 위치에 들어갈 세자리 자연수가 주어진다.

출력

첫째 줄부터 넷째 줄까지 차례대로 (3), (4), (5), (6)에 들어갈 값을 출력한다.

예제 입력 1 복사

472
385

예제 출력 1 복사

2360
3776
1416
181720

 

 

package org.example;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {


    public static void main(String[] args) throws IOException {

        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

        String s = bf.readLine();

        String[] split = s.split("");

        String s1 = bf.readLine();

        String[] multiply = s1.split("");


        int i1 = Integer.parseInt(s);
        int i4 = Integer.parseInt(multiply[0]);
        int i5 = Integer.parseInt(multiply[1]);
        int i6 = Integer.parseInt(multiply[2]);

        int first  = i1 * i4;
        int second = i1 * i5;
        int third = i1 * i6;

        int result = i1 * Integer.parseInt(s1);

        System.out.println(third);
        System.out.println(second);
        System.out.println(first);
        System.out.println(result);


    }
}

'PS > 백준' 카테고리의 다른 글

백준 - 수 정렬하기 2 (2751번)  (0) 2023.10.08
백준 - 커트라인(25305번)  (2) 2023.10.08
백준 - 고양이 (10171번)  (0) 2023.10.07
백준 - 개수 세기(10807번)  (0) 2023.10.01
백준 - A+B - 5 (10952번)  (1) 2023.09.30

댓글