알고리즘/BOJ

백준 21612번 Boiling Water

꾸준함. 2021. 5. 2. 22:33

문제 링크입니다: www.acmicpc.net/problem/21612

 

21612번: Boiling Water

At sea level, atmospheric pressure is 100 kPa and water begins to boil at 100◦C. As you go above sea level, atmospheric pressure decreases, and water boils at lower temperatures. As you go below sea level, atmospheric pressure increases, and water boils

www.acmicpc.net

간단한 구현 문제였습니다.

 

#include <iostream>
using namespace std;
const int SEA_LEVEL = 100;
int main(void)
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int B;
cin >> B;
int P = 5 * B - 400;
cout << P << "\n";
if (P < SEA_LEVEL)
{
cout << 1 << '\n';
}
else if (P > SEA_LEVEL)
{
cout << -1 << "\n";
}
else
{
cout << 0 << "\n";
}
return 0;
}
view raw .cpp hosted with ❤ by GitHub

 

개발환경:Visual Studio 2017

 

지적, 조언, 질문 환영입니다! 댓글 남겨주세요~

반응형