求助,用的递归
查看原帖
求助,用的递归
967841
__CrossBow_EXE__楼主2023/7/18 19:00
#include<iostream>
using namespace std;
int n;
int f(int x){
	if(x%2==0){
		return f(x/2);
		cout<<x<<' ';
	}
	if(x%2==1){
		return f(x*3+1);
		cout<<x<<' ';
	}
	
}
int main(){
	cin>>n;
	f(n);
	return 0;
}

啥也不输出

2023/7/18 19:00
加载中...