문제 링크입니다: https://www.acmicpc.net/problem/6162
6162번: Superlatives
Typically, droughts are classified into “abnormally dry”, “moderate drought”, “severe drought”, “extreme drought”, and “exceptional drought”. The current drought is so “exceptional” in most of California that there have been discuss
www.acmicpc.net
간단한 구현 문제였습니다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void printResult(int k, int E, int A) | |
{ | |
cout << "Data Set " << k << ":\n"; | |
int cnt = 0; | |
while (E > A) | |
{ | |
A *= 5; | |
cnt++; | |
} | |
if (cnt == 0) | |
{ | |
cout << "no drought\n\n"; | |
return; | |
} | |
for (int i = 0; i < cnt - 1; i++) | |
{ | |
cout << "mega "; | |
} | |
cout << "drought\n\n"; | |
} | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
int K; | |
cin >> K; | |
for (int k = 1; k <= K; k++) | |
{ | |
int E, A; | |
cin >> E >> A; | |
printResult(k, E, A); | |
} | |
return 0; | |
} |

개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 6249번 TV Reports (0) | 2021.05.30 |
---|---|
백준 6190번 Another Cow Number Game (0) | 2021.05.29 |
백준 6139번 Speed Reading (0) | 2021.05.29 |
백준 6131번 완전 제곱수 (0) | 2021.05.29 |
백준 6060번 Wheel Rotation (0) | 2021.05.29 |