The 3n + 1 problem (C++代码) principle's simple c++ 摘要:解题思路:注意事项:此题有两个坑点:第一,并没有说i一定小于j第二,在输入后就应该立刻输出,否则对ij处理完之后就会出错。当然,用户体验用脚趾头想一下都知道非常糟糕。参考代码:#include <io…… 题解列表 2017年12月21日 1 点赞 0 评论 1059 浏览 评分:0.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 评论 203 浏览 评分:0.0
The 3n + 1 problem 摘要:解题思路:利用for循环逐个遍历输入数之间的数,计算每一个数的周期,找到最大周期即可注意事项:本题有一个坑,输入的第一个数不一定是大于第二个数的,所以需要找到输入两数中的较大值与较小值参考代码:#in…… 题解列表 2024年03月08日 0 点赞 0 评论 229 浏览 评分:0.0
LikeWater - 1095: The 3n + 1 problem 摘要:#####这题挺搞心态的,题目样例全是a小于b结果提交测试里面会有a大于b的情况,然后导致出错,要是有执拗的人不想看题解真要被折磨半天,题目应该提示一下,不然很烦。 ```cpp #inclu…… 题解列表 2023年03月22日 0 点赞 0 评论 388 浏览 评分:0.0
我这个应该是挺好理解的吧 摘要:```cpp #include using namespace std; int main() { int n,m; while(cin>>n>>m)//n…… 题解列表 2023年01月19日 0 点赞 0 评论 225 浏览 评分:0.0
题解 1095: The 3n + 1 problem 关于超时 摘要:注意事项:关于超时,while(a!=1)我写成while(a>=1)就超时了,不太明白参考代码:#include<iostream> #include<string> using namespa…… 题解列表 2022年05月20日 0 点赞 0 评论 171 浏览 评分:0.0
The 3n+1 problem 摘要:解题思路:注意事项:参考代码:#include <iostream>#include <algorithm>using namespace std;long long len(long long n)…… 题解列表 2022年02月04日 0 点赞 0 评论 175 浏览 评分:0.0
1095: The 3n + 1 problem 摘要:从 a 到 b 挨个判断跌落到 1 需要的次数,保存最大的次数。注意 a 大于 b 的情形。#include <bits/stdc++.h> using namespace std; int …… 题解列表 2022年01月01日 0 点赞 0 评论 158 浏览 评分:0.0
筛法(赌他不卡我数据 摘要:解题思路:注意事项:参考代码#include <bits/stdc++.h>using namespace std;int a[1001000];int fuck(int x) { int ans =…… 题解列表 2021年04月16日 0 点赞 0 评论 214 浏览 评分:0.0
思路清晰的解答 摘要:解题思路:按照从大到小或者从小到大的顺序遍历从m到n的所有值(m和n是输入的)。设定temp记录不同值对应len。设定max记录m和n之间(包括i和j)的整数的最大循环长度,每次得到len后与max比…… 题解列表 2021年03月07日 0 点赞 0 评论 247 浏览 评分:0.0