blob: c4bf464623ab7e300c434e9964c5121050124fd0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include <iostream>
#include <cassert>
int parseSensor(int s) { return ((((s=(s>>1)&(~0xF617A100))<0x54)?s|0xF01:s&0xCBFF)>>2)-21; }
int main() {
int rawValue;
std::cin >> rawValue;
int temp = parseSensor(rawValue);
assert(-20 <= temp);
assert(temp <= 40);
if (30 <= temp && temp <= 40) {
std::cout << "Hot" << std::endl;
}
else if (20 <= temp && temp <= 29) {
std::cout << "Warm" << std::endl;
}
else if (11 <= temp && temp <= 19) {
std::cout << "Temperate" << std::endl;
}
else if (0 <= temp && temp <= 10) {
std::cout << "Cold" << std::endl;
}
else if (-20 <= temp && temp <= -1) {
std::cout << "Freezing" << std::endl;
}
}
|