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 ...
随机推荐
- 在浏览器的市场上,IE依然是放弃了,firefox还在继续~~
自从微软失败后,发布了Edge:但是依然是没有多少市场的,毕竟各种难受: 单从开发者工具,我是没有其它选择了, ie的不能用,https://www.microsoft.com/en-us/welco ...
- (LaTex)CTex的初次使用心得及入门教程
摘要 最近要发论文了,被知乎里人推荐使用论文编译软件(CTex.LaTex和Overleaf之类),瞬间感觉自己用Word简直Out了(书读少). 学校里也听说过LaTex,不过因为当时没怎么写过论文 ...
- C++ 数据库 char 转 wchar_t SQLWCHAR
C++中对数据库的操作感觉太复杂了,不如C#好使,但最近出于某些原因还是学习了一下C++下操作数据库的方法. 如果要想用C++实现对数据库的操作其实很简单,但是如果你需要动态的操作数据库(比如获得用户 ...
- AndroidStudio 添加 AndroidAnnotations
1.添加对apt的依赖 buildscript { repositories { mavenCentral() } dependencies { classpath 'com.neenbedankt. ...
- NTP原理初步与配置
一.Ntp基本原理 Server和·Client之间的同步(C/S模式) 1.主机启动ntp daemon 2.Client向NTP Server 发送调较时间的申请 3.NTP Server发送标准 ...
- 郑州Day6
今天考了毕姥爷的一套题,差点保龄 题目 挺良心的一套题,至少我不用再搬一遍题面了 T1.B君的第一题 我为什么当时去写了一个树形\(dp\)还妄图\(A\)掉啊 这题保龄感觉舒爽 首先如果我们要求的是 ...
- POJ 1416 Shredding Company【dfs入门】
题目传送门:http://poj.org/problem?id=1416 Shredding Company Time Limit: 1000MS Memory Limit: 10000K Tot ...
- Python-Url编码和解码
一.为什么要进行Url编码 url带参数的请求格式为(举例): http://www.baidu.com/s?k1=v1&k2=v2 当请求数据为字典data = {k1:v1, k2:v2} ...
- NW.js开发环境的搭建
写在前面: 之前一直在找关于在mac怎么搭建nw.js的开发环境,苦于自己也没有很深入的理解,其实看看官方文档就差不多知道mac下要怎么整了. 官方文档的图: 正题开始: 先去下载一个nw.js的安装 ...
- 了解Mysql与MariaDb的关系
MariaDB是MySQL源代码的一个分支,随着Oracle买下Sun,MySQL也落入了关系型数据库王者之手.在意识到Oracle会对MySQL许可做什么后便分离了出来(MySQL先后被Sun.Or ...