题解 1095: The 3n + 1 problem

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

1095 3n+1(递归解决)

摘要:解题思路:注意事项:参考代码:#include<stdio.h>long long digui(int n,long long m){ if(n==1)//如果是 1 ,就退出循环  { m+=1;……

The 3n + 1 problem,goto真好用!

摘要:解题思路:注意事项:参考代码:#include"bits/stdc++.h" using namespace std; int main(){     // 定义变量a, b, c和数组d,l用……

会调用函数就可以

摘要:解题思路:注意事项:注意比较输入两个数的大小参考代码:#include <stdio.h>int c(int n) { int length = 1; // 初始……

注意审题有陷阱,花我那么多时间

摘要:解题思路:注意事项:有可能n>m,如果用for从n到m要换位置,而且输出的时候要注意以输入时的顺序输出参考代码:#include<stdio.h>#include<string……

The 3n + 1 problem

摘要:解题思路:注意事项:参考代码:#include<stdio.h>int prime(int a){ int c = 0; while (a != 1) { c++; if (a % 2……