Notice
Recent Posts
Recent Comments
Link
250x250
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

피너클의 it공부방

백준 14470 전자레인지 (c++) : 피너클 본문

백준

백준 14470 전자레인지 (c++) : 피너클

피너클 2022. 6. 12. 13:57
728x90
반응형

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

 

14470번: 전자레인지

JOI 군은 식사 준비를 위해 A℃의 고기를 전자레인지로 B℃까지 데우려고 한다. 고기는 온도가 0℃보다 낮을 때 얼어 있고, 0℃보다 높을 때는 얼어 있지 않다. 온도가 정확히 0℃일 때 고기는 얼어

www.acmicpc.net

간단한 구현문제다.

#include <iostream>

using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int time = 0;

	if (a < 0) time = -a * c + d + e * b;
	else if (a == 0) time = d + e * b;
	else time = e * (b - a);
	
	cout << time << endl;
}

전체코드다.

728x90
반응형
Comments