알고리즘/BOJ

백준 20233번 Bicycle

꾸준함. 2021. 3. 29. 23:38

문제 링크입니다: www.acmicpc.net/problem/20233

 

20233번: Bicycle

The first four lines of the input contain integers $a$, $x$, $b$, and $y$ ($0 \leq a, x, b, y \leq 100$), each on a separate line. The last line contains a single integer $T$ ($1 \leq T \leq 1440$) --- the total time spent on a bicycle during each day.

www.acmicpc.net

간단한 구현 문제였습니다.

 

#include <iostream>
#include <algorithm>
using namespace std;
const int WORKING_DAY = 21;
const int FIRST_OPTION_FREE_MINUTE = 30;
const int SECOND_OPTION_FREE_MINUTE = 45;
int main(void)
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int a, x, b, y, T;
cin >> a >> x >> b >> y >> T;
int firstOption = max(0, T - FIRST_OPTION_FREE_MINUTE) * x * WORKING_DAY + a;
int secondOption = max(0, T - SECOND_OPTION_FREE_MINUTE) * y * WORKING_DAY + b;
cout << firstOption << " " << secondOption << "\n";
return 0;
}
view raw .cpp hosted with ❤ by GitHub

 

개발환경:Visual Studio 2017

 

지적, 조언, 질문 환영입니다! 댓글 남겨주세요~

반응형

'알고리즘 > BOJ' 카테고리의 다른 글

백준 20353번 Atrium  (0) 2021.03.29
백준 20352번 Circus  (0) 2021.03.29
백준 20232번 Archivist  (0) 2021.03.29
백준 20215번 Cutting Corners  (0) 2021.03.29
백준 19944번 뉴비의 기준은 뭘까?  (3) 2021.03.29