g0_Og @ 2023-08-23 17:24:36
#include<iostream>
using namespace std;
int main(){
int n;
scanf ("%d" ,&n);
for( ;n !=1; ){
if(n % 2==1)
{
printf("%d*3+1=%d\n",n,(n*3+1));
n=n*3 + 1;
}
else
{
printf("%d/2=%d\n",n,(n/2));
n=n/2;
}
}
cout <<"End";
}
by HaIall @ 2023-08-23 17:25:49
@g0_Og 要开longlong不然会炸
by g0_Og @ 2023-08-23 17:33:27
@HaIall 额,变两个红了
by tongzhenxuan @ 2023-08-23 17:36:18
@g0_Og long long输出输入要%lld
by g0_Og @ 2023-08-23 17:39:04
@tongzhenxuan 明白了谢谢大佬
by xwx123456 @ 2023-08-24 11:33:07
绿萝