/* 螻襴讀 碁企 覿 覓語 1 : 3N+ 1 覓語 ---------------------------------------- 1. 襯 2. 伎 襯 3螻 螳 螻 3. 讌企 2襦 , 企 3朱 螻燕 れ 1 4. 蠏碁 1 蟾讌 覦覲 5. 伎 螳 1 蟾讌 豕 螻襯 蟲 蟆 ) 22 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 --> 豐 16螻 */ #include "stdafx.h" #include <iostream> using namespace std; int main(int argc, _TCHAR* argv[]) { int i, j, max = 1, max_temp = 1; cin >> i >> j; if(j < i) { int temp; temp = j; j = i; i = temp; } if ( i > 0 && j > 0 && i < 1000000 && j < 1000000) { for(int loop = i; loop <= j; loop++) { int val = loop; //cout << val << " : "; while(val > 1) { if(val % 2 == 0) val = val / 2; else val = val * 3 + 1; max_temp++; //cout << val << ", "; } if(max_temp > max) max = max_temp; max_temp = 0; } cout << "\n" << i << " "; cout << j << " "; cout << max + 1 << endl; } else cout << "ロ 覯 0覲企 螻, 1000000 覲企 ." << endl; return 0; }