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 ...
随机推荐
- 如何在SAP CRM WebClient UI里创建HANA Live Report
1. 使用业务角色ANALYTICSPRO登录WebClient UI: 2. 点击新建按钮: 为新建的报表分配一个HANA Live Query: 指定Query的参数: 上图WebClient U ...
- (转)python with as的用法
源地址https://www.cnblogs.com/DswCnblog/p/6126588.html With语句是什么? 有一些任务,可能事先需要设置,事后做清理工作.对于这种场景,Python的 ...
- Android(java)学习笔记51:ScrollView用法
1. 理论部分 (1)ScrollView和HorizontalScrollView是为控件或者布局添加滚动条 (2)上述两个控件只能有一个孩子,但是它并不是传统意义上的容器 (3)上述两个控件可以互 ...
- 20165322 实验一 Java开发环境的熟悉
实验一 Java开发环境的熟悉 一.实验内容及步骤 (一)命令行下Java程序开发 按照步骤新建目录.键入代码,再编译运行输出.运行结果和TREE结构图如下: (二) IDEA下Java程序开发.调试 ...
- 【LOJ2461】「2018 集训队互测 Day 1」完美的队列(分块+双指针)
点此看题面 大致题意: 让你维护\(n\)个有限定长度的队列,每次区间往队列里加数,求每次加完后的队列里剩余元素种类数. 核心思路 这道题可以用分块+双指针去搞. 考虑求出每个操作插入的元素在队列中被 ...
- 【[SDOI2013]随机数生成器】
题目 来画柿子吧 我们要求的是 \[f(x)\equiv t(mod\ \ p)\] 其中\(f(1)=x_0,f(x)=af(x-1)+b\) 我们来写几项柿子看看 \[f(1)=x_0\] \[f ...
- activeMQ消息队列的使用
ActiveMQ解决问题: 1.解决服务之间的耦合 2.增加系统并发处理量. 它使用的是标准生产者和消费者模型.有两种数据结构:Queue/Topic 1.Queue队列,生产者生产一个消息,只能由 ...
- caffe卷积层实现
下图是jiayangqing在知乎上的回答,其实过程就是把image转换成矩阵,然后进行矩阵运算 卷积的实现在conv_layer层,conv_layer层继承了base_conv_layer层,ba ...
- mac下配置Node.js开发环境、express安装、创建项目
mac下配置Node.js开发环境.express安装.创建项目 一.node.js的安装 去官网下载对应的平台版本就可以了,https://nodejs.org 二.express安装 sudo n ...
- 【Calculus 微积分の一些个人理解】
微积分 微积分(Calculus)是高等数学中研究函数的微分(Differentiation).积分(Integration)以及有关概念和应用的数学分支.它是数学的一个基础学科.内容主要包括极限.微 ...