글 작성자: 취업중인 피터팬
728x90

https://www.acmicpc.net/problem/8370

 

8370번: Plane

In the first and only line of the standard input there are four integers n1, k1, n2 and k2 (1 ≤ n1, k1, n2, k2 ≤ 1 000), separated by single spaces.

www.acmicpc.net

 

비즈니스 석과 이코노미 석의 추가 열과 열 당 좌석 개수로 전체 추가된 좌석을 구하는 문제입니다.

 

정답

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n1 = sc.nextInt();
        int k1 = sc.nextInt();
        int k2 = sc.nextInt();
        int n2 = sc.nextInt();
        
        System.out.println(n1*k1 + k2*n2);
    }
}