[백준] Baekjoon Online Judge
문제
There is a new conveyor belt sushi restaurant in town. Plates of sushi travel around the restaurant on a raised conveyor belt and customers choose what to eat by removing plates.
Each red plate of sushi costs $3, each green plate of sushi costs $4, and each blue plate of sushi costs $5.
Your job is to determine the cost of a meal, given the number of plates of each colour chosen by a customer.
입력
The first line of input contains a non-negative integer, R, representing the number of red plates chosen. The second line contains a non-negative integer, G, representing the number of green plates chosen. The third line contains a non-negative integer, B, representing the number of blue plates chosen.
출력
Output the non-negative integer, C, which is the cost of the meal in dollars.
풀이
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int r, g, b;
cin >> r >> g >> b;
cout << r * 3 + g * 4 + b * 5 << '\n';
return 0;
}
입력 받은 접시의 수에 각 접시의 비용을 곱해서 더하면 된다.
'백준 > C++' 카테고리의 다른 글
[Baekjoon/C++] 1000번 - A+B (0) | 2024.11.11 |
---|---|
[Baekjoon/C++] 22113번 - 창영이와 버스 (2) | 2024.11.09 |
[Baekjoon/C++] 20540번 - 연길이의 이상형 (0) | 2024.11.08 |
[Baekjoon/C++] 1940번 - 주몽 (0) | 2024.11.06 |
[Baekjoon/C++] 7795번 - 먹을 것인가 먹힐 것인가 (0) | 2024.11.04 |