본문 바로가기
공부/코딩테스트

백준: 8370번 Plane (Python3)

by 혼밥맨 2022. 7. 23.
반응형

백준: 8370번 Plane (Python3)

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB 4820 4271 4137 89.102%

문제

Byteland Airlines recently extended their aircraft fleet with a new model of a plane. The new acquisition has n1 rows of seats in the business class and n2 rows in the economic class. In the business class each row contains k1 seats, while each row in the economic class has k2 seats.

Write a program which:

  • reads information about available seats in the plane,
  • calculates the sum of all seats available in that plane,
  • writes the result.

입력

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.

출력

The first and only line of the standard output should contain one integer - the total number of seats available in the plane.

예제 입력 1

2 5 3 20

예제 출력 1

70

풀이

인풋이 4개의 정수로 주어진다. n1 (row), k1 (seats per row), n2 (row), k2 (seats per row) 순으로. 출력으로 비행기의 총 좌석수를 뱉어내야 하니, n1 * k1 + n2 * k2를 계산하여 출력하면 끝.

답안

1
2
n1, k1, n2, k2 = map(int, input().split())
print(n1*k1+n2*k2)
cs

반응형

댓글