끄적끄적 코딩
article thumbnail
Published 2019. 9. 13. 13:10
[C++] 백준 5543번 상근날드 알고리즘

가장 싼 햄버거와
가장 싼 음료수의 값을 더한 후 50을 빼주면 됩니다.

 

#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;

int main(int argc, char* argv[])
{
	int food[3];
	int drink[2];

	cin >> food[0];
	cin >> food[1];
	cin >> food[2];
	cin >> drink[0];
	cin >> drink[1];

	food[0] = min({ food[0], food[1], food[2]});
	drink[0] = min(drink[0], drink[1]);

	cout << food[0] + drink[0] - 50 << endl;

	return 0;
}

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

[C++] 백준 10886번 0 = not cute / 1 = cute  (0) 2019.09.13
[C++] 백준 5565번 영수증  (0) 2019.09.13
[C++] 백준 10797번 10부제  (0) 2019.09.13
[C++] 백준 2490번 윷놀이  (0) 2019.09.13
[C++] 백준 10039번 평균 점수  (0) 2019.09.13

검색 태그