The 3n + 1 problem (c++) 摘要:解题思路:真的是又长又臭参考代码:#include<iostream>using namespace std;int main(){ long long count = 1; long l…… 题解列表 2022年07月14日 0 点赞 0 评论 419 浏览 评分:9.9
1095: The 3n + 1 problem 摘要:```cpp #include using namespace std; int main() { int m,n,max; while(cin>>m>>n) {…… 题解列表 2022年08月31日 0 点赞 0 评论 647 浏览 评分:9.9
耗时18ms,好像有点高了,复杂度更达到了O(n^2).能不能更简单一点 摘要:解题思路:注意事项:参考代码:#include<bits/stdc++.h>using namespace std;int num1(int n,int m){ if(n>m) swap(n,m…… 题解列表 2022年12月10日 0 点赞 1 评论 406 浏览 评分:9.9
1095: The 3n + 1 problem ```cpp#include#includeusingnamespacestd;intfun(intnum){intcount=1;while(num!=1){if(num%2!=0){num=num*3+1;count++;}else{num/=2;count++;}}returncount;}in 题解列表 2023年01月12日 0 点赞 0 评论 458 浏览 评分:9.9
The 3n + 1 problem(水题) ```c#includeintfun(intn){intcnt=0;do{if(n%2==0){n/=2;cnt++;}else{n=n*3+1;cnt++;}}while(n!=1);returncnt+1;}intmain(){inti, 题解列表 2023年01月12日 0 点赞 0 评论 561 浏览 评分:9.9
答案不管怎么改都错误33%的同学看过来! (C++代码) 解题思路:明明写的很对,可就是错误33%,查了两小时的资料,终于知道问题出在哪里了!注意事项:输入i,j时,并不知道大小情况,所以输入后需要比较一次,但是输出时,如果在最后输出,那可能输出的是比较大小以后的i,j,即i如果大于j,输出时i,j将换位置。 题解列表 2019年03月07日 1 点赞 16 评论 2574 浏览 评分:9.8
The 3n + 1 problem -题解(C语言代码) 首先,因为这个题目是英文的,所以容我多说几句关于题目的讲解~这道题的意思就是输入两个数[i,j],区间内的每个数字,都要进行一系列运算:如果这个数字是偶数,则除以2,如果这个数字是奇数,则乘以3在加1,直到这个数最终被除为1。这些经过运算产生的数, 题解列表 2019年11月21日 0 点赞 1 评论 1095 浏览 评分:9.5
The 3n + 1 problem (Python代码) 摘要:解题思路: 这道题真的是....无法克说.... 太坑了吧也.................. 上图: 注意事项: 1. 输入 题解列表 2019年04月17日 1 点赞 2 评论 2097 浏览 评分:9.4
The 3n + 1 problem -题解(C语言代码) 摘要:#### 1095: The 3n + 1 problem [原题连接:The 3n +1 problem](https://www.dotcpp.com/oj/problem1000.html "…… 题解列表 2019年10月16日 0 点赞 8 评论 1399 浏览 评分:9.3
The 3n + 1 problem -题解(C语言代码)答案错误%33的同学请进 解题思路:首先自己已经二刷,又遇到了一些坑,在此总结思考一下先找思路,就是简单的判断偶数除2,奇数*3+1注意事项:考虑以下几个方面:1:给的i,j值可能不是按从小到大的顺序2:中间变量temp可能在计算temp=temp*3+1的过程中超int范围[详细解题思路(老师讲解)](https://mp. 题解列表 2019年12月11日 0 点赞 6 评论 1501 浏览 评分:9.3