求大佬,TLE了
  • 板块题目总版
  • 楼主hz_Glmc
  • 当前回复5
  • 已保存回复5
  • 发布时间2025/1/4 16:00
  • 上次更新2025/1/4 20:10:26
查看原帖
求大佬,TLE了
1617698
hz_Glmc楼主2025/1/4 16:00
#include<bits/stdc++.h>

using namespace std;
int main() {
    int n;  
	cin >> n;
	while(n != 1){
		if(n % 2 == 0){
			cout << n << '/' << '2' << '=' << n/2 <<endl;
			n = n/2;
		}else{
			cout << n << '*' << '3' << '+' << '1' << '=' << n*3+1 <<endl;
			n = n*3+1;
		}
	}
	printf("%s","End");
	return 0;
}
2025/1/4 16:00
加载中...