```
백준 20673번 C++ 구현해보기
```

이번 글을 통해 배워갈 내용
- 백준 20673번 풀이
https://www.acmicpc.net/problem/20673
20673번: Covid-19
The input consists of two lines. The first line contains an integer p (0 ⩽ p ⩽ 1000), showing the average number of new cases per day in every one million population in Hana’s city over the past two weeks. The second line contains an integer q (0 ⩽
www.acmicpc.net
백준 20673번은
난이도 쉬움쉬움 등급의 문제로서
숫자 P 와 Q 가 주어질때
P가 50보다 작거나 같고 Q가 10보다 작거나 같으면
White를 출력하고
Q가 30보다 크면
Red를 출력하고
그외에는
Yellow를 출력하면 되는 문제입니다.
30분 정도 위에 링크를 방문하셔서 풀어보시고
안풀리시는 경우에만 아래 해답을 봐주시면 감사하겠습니다.
단순한 출력문제이기 때문에 결과만 보시더라도 충분이 이해 가실 겁니다~
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <numeric>
#include <cmath>
int main()
{
std::cin.tie(NULL);
std::ios::sync_with_stdio(false);
int32_t avgNumNewCasesPerDay;
std::cin >> avgNumNewCasesPerDay;
int32_t avgNumNewHospitalizationsPerDay;
std::cin >> avgNumNewHospitalizationsPerDay;
std::string colorResult = "";
if ((avgNumNewCasesPerDay <= 50) && (avgNumNewHospitalizationsPerDay <= 10))
{
colorResult = "White";
}
else if (avgNumNewHospitalizationsPerDay > 30)
{
colorResult = "Red";
}
else
{
colorResult = "Yellow";
}
std::cout << colorResult;
}
읽어주셔서 감사합니다
무엇인가 얻어가셨기를 바라며
오늘도 즐거운 코딩하시길 바랍니다 ~ :)
참조 및 인용
C++ Primer
Introduction to Algorithms
https://codemasterkimc.tistory.com/35
C++ 이론을 배울수 있는 곳 정리
개요 C++을 배우는 책, 강의, 블로그, 링크 등을 공유합니다. (링크 및 간략한 설명을 하였으나 만약 원작자가 링크를 거는것을 원치 않을 경우 연락주시기 바랍니다.) 서적 https://www.amazon.com/Prime
codemasterkimc.tistory.com
https://codemasterkimc.tistory.com/50
300년차 개발자의 좋은 코드 5계명 (Clean Code)
이번 글을 통해 배워갈 내용 좋은 코드(Clean Code)를 작성하기 위해 개발자로서 생각해볼 5가지 요소를 알아보겠습니다. 개요 좋은 코드란 무엇일까요? 저는 자원이 한정적인 컴퓨터 세상에서 좋
codemasterkimc.tistory.com
'C++ > C++ 알고리즘' 카테고리의 다른 글
| 백준 2780번 비밀번호 C++ 구현해보기 (0) | 2021.09.09 |
|---|---|
| 백준 20674번 통계자료 빼기 C++ 구현해보기 (0) | 2021.09.05 |
| 백준 1012번 유기농 배추 C++ 구현해보기 (0) | 2021.09.05 |
| 백준 2163번 초콜릿자르기 C++ 구현해보기 (0) | 2021.09.04 |
| 백준 11024번 더하기4 C++ 구현해보기 (0) | 2021.09.04 |