Baekjoon Online Judge
[문제]
In the game, Deliv-e-droid, a robot droid has to deliver packages while avoiding obstacles. At the end of the game, the final score is calculated based on the following point system:
Gain 50 points for every package delivered.
Lose 10 points for every collision with an obstacle.
Earn a bonus 500 points if the number of packages delivered is greater than the number of collisions with obstacles.
Your job is to determine the final score at the end of a game.
[입력]
The input will consist of two lines. The first line will contain a non-negative integer P, representing the number of packages delivered. The second line will contain a non-negative integer C, representing the number of collisions with obstacles.
[출력]
The output will consist of a single integer F, representing the final score.
[코드]
#include <iostream>
using namespace std;
int main()
{
int p, c;
cin >> p >> c;
if (p > c)
cout << (p * 50) - (c * 10) + 500 << '\n';
else
cout << (p * 50) - (c * 10) << '\n';
return 0;
}
'Baekjoon > C++' 카테고리의 다른 글
[C++][BOJ/백준] 23303 이 문제는 D2 입니다. (0) | 2025.05.06 |
---|---|
[C++][BOJ/백준] 10974 모든 순열 (0) | 2025.05.04 |
[C++][BOJ/백준] 4949 균형잡힌 세상 (0) | 2025.04.26 |
[C++][BOJ/백준] 1158 요세푸스 문제 (0) | 2025.04.22 |
[C++][BOJ/백준] 1026 보물 (0) | 2025.04.06 |