사용 언어 : c
<풀이>
너무 쉽게 생각해서 틀려버린 문제
온도차를 절대값으로 바꿔서 10, 5, 1을 차례로 빼주는 방식으로 풀었더니 22, 3이 테스트케이스로 주어진 경우에 틀려버렸다 생각해보니 10도씩 두번 내리고 1도를 올려주면 최소한으로 작동시킬 수 있었던 것이었음..!
#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <algorithm>
int main()
{
int last_temp = 0; //나중 온도
int first_temp = 0;
int gap = 0, result = 0, c = 0;
scanf("%d", &first_temp);
scanf("%d", &last_temp);
gap = abs(last_temp - first_temp);
result = gap/10;
c = gap % 10;
if (c == 1 || c == 5) {
result += 1;
}
else if (c == 2 || c == 4 || c == 6 || c == 9)
{ result += 2;
}
else if (c == 3 || c == 7 || c == 8) {
result += 3;
}
printf("%d\n", result);
return 0;
}