#include<bits/stdc++.h>
using namespace std;
#define LL long long
LL n,ans[105ll],cnt=1ll;
int main(){
scanf("%lld",&n);
ans[1ll]=n;
while(n!=1){
if(n%2ll==1ll){
n=3ll*n+1;
}else{
n/=2ll;
}
ans[++cnt]=n;
}
for(LL i=cnt;i>=1;i--){
printf("%lld ",ans[i]);
}
return 0;
}
代码培养皿 提交记录:
With O2
https://www.luogu.com.cn/record/227344360
Unwith O2
https://www.luogu.com.cn/record/227344389
两次代码完全一样
有大佬知道这是为什么吗?