문제
https://www.acmicpc.net/problem/21638
21638번: SMS from MCHS
The first line of input contains two integers $t_1$ and $v_1$ --- the temperature and the wind speed for today ($-50 \le t_1 \le 50$; $0 \le v_1 \le 20$). The second line contains two integers $t_2$ and $v_2$ --- the temperature and the wind speed for tomo
www.acmicpc.net
해결방법
오늘과 내일의 온도와 풍속을 비교하여 적절한 조건마다 올바른 문장을 출력해주면 된다.
코드
#include<iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t1, v1, t2, v2;
cin >> t1 >> v1 >> t2 >> v2;
if (t2 < 0 && v2 >= 10)
cout << "A storm warning for tomorrow! Be careful and stay home if possible!";
else if (t2 < t1)
cout << "MCHS warns! Low temperature is expected tomorrow.";
else if (v2 > v1)
cout << "MCHS warns! Strong wind is expected tomorrow.";
else
cout << "No message";
return 0;
}'PS > Baekjoon' 카테고리의 다른 글
| [C++] 백준 11257: IT Passport Examination (0) | 2023.05.08 |
|---|---|
| [C++] 백준 3765: Celebrity jeopardy (0) | 2023.05.07 |
| [C++] 백준 24072: 帰省 (Homecoming) (0) | 2023.05.05 |
| [C++] 백준 21354: Äpplen och päron (1) | 2023.05.04 |
| [C++] 백준 11656: 접미사 배열 (0) | 2023.04.27 |
댓글