Notice
Recent Posts
Recent Comments
Link
bdfgdfg
5543번(상근날드), 5575(타임카드) 본문
반응형
5543번
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> burgerPrice;
vector<int> drink;
burgerPrice.resize(3);
drink.resize(2);
for (int i = 0; i < 3; ++i)
{
cin >> burgerPrice[i];
}
for (int i = 0; i < 2; ++i)
{
cin >> drink[i];
}
cout <<*min_element(burgerPrice.begin(), burgerPrice.end()) + *min_element(drink.begin(), drink.end()) - 50;
return 0;
}
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int hour1, minute1, second1, hour2, minute2, second2;
int resHour, resMinute, resSecond;
for (int i = 0; i < 3; ++i)
{
cin >> hour1 >> minute1 >> second1 >> hour2 >> minute2 >> second2;
if (second2 - second1 >= 0)
resSecond = second2 - second1;
else
{
--minute2;
if (minute2 == -1)
{
minute2 = 59;
--hour2;
}
resSecond = 60 + (second2 - second1);
}
if (minute2 - minute1 >= 0)
resMinute = minute2 - minute1;
else
{
--hour2;
resMinute = 60 + (minute2 - minute1);
}
resHour = hour2 - hour1;
if (resMinute == 60) resMinute = 0;
if (resSecond == 60) resSecond = 0;
cout << resHour << " " << resMinute << " " << resSecond << "\n";
}
return 0;
}
반응형
'코딩테스트 > 백준' 카테고리의 다른 글
[실버 4] 1010번 다리 놓기 (0) | 2022.01.07 |
---|---|
2530번,2588번 (0) | 2021.09.25 |
2480번, 2525번 (0) | 2021.09.17 |
3046번,5564번,8393번 (0) | 2021.09.12 |
2845번, 2914번, 3003번 (0) | 2021.09.09 |
Comments