mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
29 lines
630 B
C++
29 lines
630 B
C++
#include <stdio.h>
|
|
int main()
|
|
{
|
|
int N;
|
|
int a;
|
|
int l;
|
|
scanf("%d",&N);
|
|
while(N--){
|
|
scanf("%d",&a);
|
|
l = 0;
|
|
while(a>1){
|
|
if(a%2){
|
|
if(l == 1)
|
|
printf(" ");
|
|
l = 1;
|
|
printf("%d",a);
|
|
a = a*3+1;
|
|
}
|
|
if(a % 2 == 0){
|
|
a = a/2;
|
|
}
|
|
}
|
|
if(l == 0)
|
|
printf("No number can be output !");
|
|
printf("\n");
|
|
}
|
|
return 0;
|
|
}
|