只输出过程中的奇数
/* HDU1279 验证角谷猜想 */
#include <iostream>
using namespace std;
int main()
{
int n, m, count;
cin >> n;
while(n--) {
cin >> m;
count = 0;
while(m != 1) {
if(m & 1) {
if(count++)//输出格式,第一次不输出空格
cout << " ";
cout << m;
m = 3 * m + 1;
} else
m >>= 1; // m /= 2;
}
if(count == 0)
cout << "No number can be output !";
cout << endl;
}
return 0;
}