注意审题有陷阱,花我那么多时间 摘要:解题思路:注意事项:有可能n>m,如果用for从n到m要换位置,而且输出的时候要注意以输入时的顺序输出参考代码:#include<stdio.h>#include<string…… 题解列表 2025年02月11日 0 点赞 0 评论 38 浏览 评分:0.0
会调用函数就可以 摘要:解题思路:注意事项:注意比较输入两个数的大小参考代码:#include <stdio.h>int c(int n) { int length = 1; // 初始…… 题解列表 2025年01月12日 0 点赞 0 评论 84 浏览 评分:0.0
这题的有问题 摘要:#include<stdio.h> int ans(int n); int main(void) { int to, from, temp; int i, j; i…… 题解列表 2024年12月29日 0 点赞 1 评论 84 浏览 评分:10.0
The 3n + 1 problem,goto真好用! 摘要:解题思路:注意事项:参考代码:#include"bits/stdc++.h" using namespace std; int main(){ // 定义变量a, b, c和数组d,l用…… 题解列表 2024年11月11日 0 点赞 0 评论 115 浏览 评分:0.0
1095 3n+1(递归解决) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>long long digui(int n,long long m){ if(n==1)//如果是 1 ,就退出循环 { m+=1;…… 题解列表 2024年05月30日 0 点赞 0 评论 116 浏览 评分:0.0
The 3n + 1 problem 摘要:解题思路:利用for循环逐个遍历输入数之间的数,计算每一个数的周期,找到最大周期即可注意事项:本题有一个坑,输入的第一个数不一定是大于第二个数的,所以需要找到输入两数中的较大值与较小值参考代码:#in…… 题解列表 2024年03月08日 0 点赞 0 评论 126 浏览 评分:0.0
The 3n + 1 problem 摘要:解题思路:注意事项:参考代码:#include <stdio.h>#include<math.h>int main(){ int a,b; int i = 0; int x; while (scan…… 题解列表 2024年03月05日 0 点赞 0 评论 153 浏览 评分:0.0
1095: The 3n + 1 problem 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int f(int n){ int i=1; while(n!=1) { if(n%2==0) n=n/2; else …… 题解列表 2023年11月03日 0 点赞 0 评论 93 浏览 评分:0.0
The 3n + 1 problem(乐,别忘了i和j的值要比下大小,再使用,还有如果i如果大于j的话,你交换了他们的值,但最终结果输出i和j必须是输入的i和j) 摘要:解题思路:注意事项:参考代码:#include<stdio.h> int main() { int a,b; while(~scanf("%d%d",&a,&b)) { i…… 题解列表 2023年10月04日 0 点赞 0 评论 55 浏览 评分:0.0
题解 1095: The 3n + 1 problem 摘要:解题思路:注意事项:还得先比较输入的两个数的大小!!!参考代码#include<stdio.h> int main() { int a,b,m,n,j,temp; int su…… 题解列表 2023年04月03日 0 点赞 0 评论 69 浏览 评分:0.0