소감 ¶
ACM첫번째 문제
between i and j에서 i는 j보다 클수도 있음
이것땜에 고생했었음...
between i and j에서 i는 j보다 클수도 있음
이것땜에 고생했었음...
소스 ¶
~cpp 
// 100
#include <iostream>
using namespace std;
int cycle(int n);
void main()
{
	int i, j, great_length;
	while (cin >> i >> j)
	{
		int temp_i = i;
		int temp_j = j;
		if (temp_i > temp_j)
		{
			int temp;
			temp = temp_i;
			temp_i = temp_j;
			temp_j = temp;
		}
		great_length = cycle(temp_i);
		while (temp_i < temp_j)
		{
			temp_i++;
			int temp;
			if ((temp = cycle(temp_i)) > great_length)
				great_length = temp;
		}
		cout << i << " " << j << " " << great_length << endl;
	}
}
int cycle(int n)
{
	int cnt = 1;
	while (n != 1)
	{
		if (n % 2 == 1)
			n = 3 * n + 1;
		else
			n = n / 2;
		cnt++;
	}
	return cnt;
}













