hdu1032

2018-06-04 11:00:08 浏览数 (1)

#include <iostream> using namespace std; int main() { int a,b,t,i,max; while(cin >> a >> b) { cout << a << " " << b << " "; if(a>b)//大小不确定 { t = a; a = b; b = t; } max = 0; for(i = a; i<=b; i ) { int n = i, sum = 1; while(n-1)//等于1时就结束 { if(n%2) n = 3*n 1; else n = n/2; sum ; } if(sum>max) max = sum; } cout << max << endl; } return 0; }

0 人点赞