본문 바로가기

코딩테스트/Coding Bat

[코딩뱃] [자바] Warmup - 1단계 : icyHot 문제

728x90
728x90

 

https://codingbat.com/prob/p192082

 

CodingBat Java Warmup-1 icyHot

Given two temperatures, return true if one is less than 0 and the other is greater than 100.icyHot(120, -1) → trueicyHot(-1, 120) → trueicyHot(2, 120) → falseGo...Save, Compile, Run (ctrl-enter)Show Solution

codingbat.com



= 문제 번역 =

두 개의 온도가 주어지면 하나는 0보다 작고 다른 하나는 100보다 크면 true를 반환합니다.

 

= 문제푸는 팁 =

문제 해설을 잘못읽어서, 둘다 0보다 작거나 둘다 100보다 크면 true로 봐서 문제를 이상하게 풀었다.

매 번 문제를 풀 떄는, 문제의 조건을 다시 상기하면서 풀도록 할 것!

 

= 해설 =

public boolean icyHot(int temp1, int temp2) {
if((temp1<0&&temp2>100)||(temp1>100&&temp2<0))return true;
else return false;
}

728x90