-
[codility] FrogJmp c++Coding Test/codility 2022. 4. 8. 16:52728x90
- 문제
- 문제 풀이
#include <string> #include <algorithm> #include <cmath> int solution(int X, int Y, int D) { // write your code in C++14 (g++ 6.2.0) int distance = Y - X; if (distance <= 0) return 0; double jump = distance / (double)D; return (int)ceil(jump); } #define FrogJmp #ifdef FrogJmp int main() { int X = 10, Y = 85, D = 30; std::cout << solution(X, Y, D); return 0; } #endif
728x90'Coding Test > codility' 카테고리의 다른 글
[codility] TapeEquilibrium c++ (0) 2022.04.09 [codility] PermMissingElem c++ (0) 2022.04.09 [codility] OddOccurrencesInArray c++ (0) 2022.04.08 [codility] CyclicRotation c++ (0) 2022.04.08 [codility] BinaryGap c++ (0) 2022.04.08