UVa Problem 100 The 3n+1 problem (3n+1 问题)
参考:https://blog.csdn.net/metaphysis/article/details/6431937
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
ll a,b;
ll length(ll x)
{
ll l=;
while (x!=)
{
if (x%==)
{
x=*x+;
}
else
{
x=x/;
}
l++;
}
return l;
}
int main()
{
// freopen("text.txt","r",stdin);
while (scanf("%lld %lld",&a,&b)!=EOF)
{
ll ma=;
for (ll i=min(a,b);i<=max(a,b);i++)//注意输入要先排大小!
{
ma=max(ma,length(i));
}
printf("%lld %lld %lld\n",a,b,ma);
} return ;
}
UVa Problem 100 The 3n+1 problem (3n+1 问题)的更多相关文章
- UVa 100 - The 3n + 1 problem(函数循环长度)
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&pa ...
- 【转】UVa Problem 100 The 3n+1 problem (3n+1 问题)——(离线计算)
// The 3n+1 problem (3n+1 问题) // PC/UVa IDs: 110101/100, Popularity: A, Success rate: low Level: 1 / ...
- PC/UVa 题号: 110101/100 The 3n+1 problem (3n+1 问题)
The 3n + 1 problem Background Problems in Computer Science are often classified as belonging to a ...
- UVA 100 - The 3n+1 problem (3n+1 问题)
100 - The 3n+1 problem (3n+1 问题) /* * 100 - The 3n+1 problem (3n+1 问题) * 作者 仪冰 * QQ 974817955 * * [问 ...
- 100-The 3n + 1 problem
本文档下载 题目: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_pro ...
- The 3n + 1 problem
The 3n + 1 problem Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) ...
- poj1207 3n+1 problem
The 3n + 1 problem Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 60496 Accepted: 19 ...
- 杭电OJ——1032 The 3n + 1 problem
The 3n + 1 problem Problem Description Problems in Computer Science are often classified as belongin ...
- HDU 1032 The 3n + 1 problem (这个题必须写博客)
The 3n + 1 problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- 烟大 Contest1024 - 《挑战编程》第一章:入门 Problem A: The 3n + 1 problem(水题)
Problem A: The 3n + 1 problem Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 14 Solved: 6[Submit][St ...
随机推荐
- May 22nd 2017 Week 21st Monday
The biggest adventure you can take is to live the life of your dreams. 你能经历的最大的冒险,就是过上你梦想的生活. Just l ...
- windows10 、eclipse kepler配置maven环境
maven环境的配置需要先配置Java环境. 一.在wIn10 中配置maven环境,需要先下载maven压缩包,官网http://maven.apache.org/download.cgi,我选择下 ...
- 如何为属性是disabled的表单绑定js事件
$(document).click(function(e){ var el = e.target; if (el.tagName == 'INPUT') { $(el).removeAttr('dis ...
- 安卓Socket开发注意事项
如果要在安卓app里用到Socket通信,要满足: 1.在写代码的activity里import进Socket相关的包,这个很easy,如果你不知道要import什么包,也可以先不指定,可 ...
- PHP使用memcache长连接作为RPC客户端需要注意的地方
memcache扩展版本 3.0.8 一. retry_interval $retry_interval 某个rpc服务器端失败后故障转移的时间,retry_interval的时间内,该节点会被一直标 ...
- bzoj 1597 斜率DP
1597: [Usaco2008 Mar]土地购买 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 5115 Solved: 1897[Submit] ...
- 手机验证码免费10条\java、C#、html....
使用互亿无线短信接口网址:http://www.ihuyi.com/. 首先第一步,进行注册 第二步:注册成功后进来的页面 第三步:实名认证 第四步:个人信息 等待认证成功后才能继续操作 第五步:进行 ...
- android jni 之C语言基础
*含义 1.乘法 3*5 2.定义指针变量 int * p://定义了一个名字叫p的变量,能够存放int数据类型的地址 3.指针运算符, //如果p是一个已经定义好的指针变量则*p表示以p的内容为地址 ...
- POJ 2533 Longest Ordered Subsequence(裸LIS)
传送门: http://poj.org/problem?id=2533 Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 6 ...
- An Algorithm for Surface Encoding and Reconstruction From 3D Point Cloud Data
An Algorithm for Surface Encoding and Reconstruction From 3D Point Cloud Data https://www.youtube.co ...