= 소감 = {{| 2006.1.6 8.842s |}} = 코드 = {{{~cpp #include using namespace std; int count = 0; int i, j; bool input() { count = 0; if (cin >> i >> j) return true; return false; } int process(int n) { count++; if(n == 1) { return count; } else if(n % 2 == 1) { n = 3 * n + 1; return process(n); } else { n /= 2; return process(n); } } int compare() { int temp; int temp2; if(i == j) return process(i); else { temp = 0; count = 0; if(i > j) { for(int k = j; k <= i; k++) { temp2 = process(k); count = 0; if(temp <= temp2) { temp = temp2; } } } else { for(int k = i; k <= j; k++) { temp2 = process(k); count = 0; if(temp <= temp2) { temp = temp2; } } } return temp; } } int main() { while(input()) { int temp= compare(); cout << i << " " << j << " " << temp << endl;; } return 0; } }}} 이때 내가 어떻게 이 문제를 풀었을까.. 대단대단.. 하지만 고치고 싶은 부분이 많이 보인다 ㅋ - 나 ---- [3N+1Problem]