The 3n + 1 problem (C++代码) 摘要:解题思路:这个问题其实很简单,无非就是先把输入的数据先存储起来,在对每组数据进行一个找最大周期长度的过程,存储的话我用的是vector,找最大周期长度写一个while循环注意事项:1、算最大周期长度要…… 题解列表 2018年09月04日 0 点赞 0 评论 607 浏览 评分:0.0
The 3n + 1 problem (C++代码) 摘要:数字本身也正在运行次数类,所以最后的max要加1每次循环结束记得要k归0,最大值也要归零#include<iostream>using namespace std;int main() { long …… 题解列表 2018年08月02日 0 点赞 0 评论 468 浏览 评分:0.0
The 3n + 1 problem (C++代码) 摘要:解题思路:求最大循环长度注意事项:参考代码:#include <iostream>#include <cstdio>using namespace std;int main(){int m,n;whi…… 题解列表 2018年08月02日 0 点赞 0 评论 452 浏览 评分:0.0
此解可AC (C语言代码) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int i, j, k, count = 1, max = 0, t; while (scanf("%d %d"…… 题解列表 2018年07月16日 1 点赞 0 评论 729 浏览 评分:0.0
The 3n + 1 problem (C语言代码) 摘要:解题思路:注意事项:注意输入的i j的大小不一定谁大谁小,不要惯性思维先把i j输出了再说,因为题目要求输出顺序与输入相同注意max变量的复原参考代码:#include <stdio.h>#inclu…… 题解列表 2018年05月07日 0 点赞 0 评论 568 浏览 评分:0.0
The 3n + 1 problem (Java代码) 摘要:解题思路:先写一个简单的静态方法来判断每个数的次数,再写一个主方法来输入输出就ok啦注意事项:就是判断输入两个数的时候要判断下大小问题就好啦,我的这个和那个对的有什么区别,为啥我的就是错误 知道的告诉…… 题解列表 2018年04月05日 0 点赞 0 评论 778 浏览 评分:0.0
The 3n + 1 problem (C++代码) 摘要:解题思路:注意事项:参考代码:#include<stdio.h>#include<string.h>#include<algorithm>#include<math.h>using namespace…… 题解列表 2018年03月18日 0 点赞 0 评论 632 浏览 评分:0.0
The 3n + 1 problem (C++代码) 摘要:参考代码:#include <iostream> using namespace std; int main() { int i,j,tot; while(cin>>i>>j…… 题解列表 2018年02月16日 2 点赞 3 评论 558 浏览 评分:0.0
The 3n + 1 problem (Java代码) 摘要:解题思路:注意事项:1.注意n*3可能int型不够用,用long2.输入的时候可能a比b大,所以要换位置代入函数。参考代码:import java.util.Scanner; public cl…… 题解列表 2018年02月03日 0 点赞 0 评论 703 浏览 评分:0.0
The 3n + 1 problem (Java代码) 摘要:解题思路:注意事项:参考代码:import java.util.Scanner; public class Main { public static long cishu(long n){ …… 题解列表 2018年01月30日 1 点赞 0 评论 824 浏览 评分:0.0