알고리즘_생각하기/Coding Game(2)
-
CodingGame - Temperatures
목표 : 여러 온도 중 0에 가장 가까운 온도를 찾아라 규칙 : 음수와 양수의 절대값이 같다면 양수를 더 가깝다고 쳐 준다. 첫 번째 줄에서 입력받을 온도의 갯수 두 번째 줄에서 온도를 담을 문자열, -273 ~ 5526 까지 풀이 사용 언어 : C++ #include #include #include #include using namespace std; /** * Auto-generated code below aims at helping you parse * the standard input according to the problem statement. **/ int main() { int n;//온도의 갯수 int t = 5527; // 최댓값보다 더 높은 수로 온도 초기화 int mint = 552..
2020.04.27 -
CodingGame - The Descent
목표 : 우주선이 산에 충돌하지 않도록 가장 높은 산 부터 파괴하라 규칙 : 산의 갯수는 8개, 왼쪽 산부터 차례대로 높이를 알려줍니다. 텀 종료 시 가장 높은 산에 발포, 파괴해야 합니다. 우주선은 조금씩 하강합니다. 풀이 사용 언어 : C++ #include #include #include #include using namespace std; /** * The while loop represents the game. * Each iteration represents a turn of the game * where you are given inputs (the heights of the mountains) * and where you have to print an output (the index of ..
2020.04.27