poj1207
| Time Limit: 1000MS | Memory Limit: 10000K | |
| Total Submissions: 50513 | Accepted: 15986 |
Description
Consider the following algorithm:
1. input n 2. print n 3. if n = 1 then STOP 4. if n is odd then n <-- 3n+1 5. else n <-- n/2 6. GOTO 2
Given the input 22, the following sequence of numbers will be printed 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1
It is conjectured that the algorithm above will terminate (when a 1 is printed) for any integral input value. Despite the simplicity of the algorithm, it is unknown whether this conjecture is true. It has been verified, however, for all integers n such that 0 < n < 1,000,000 (and, in fact, for many more numbers than this.)
Given an input n, it is possible to determine the number of numbers printed before the 1 is printed. For a given n this is called the cycle-length of n. In the example above, the cycle length of 22 is 16.
For any two numbers i and j you are to determine the maximum cycle length over all numbers between i and j.
Input
You should process all pairs of integers and for each pair determine the maximum cycle length over all integers between and including i and j.
Output
Sample Input
1 10
100 200
201 210
900 1000
Sample Output
1 10 20
100 200 125
201 210 89
900 1000 174
Source
poj1207的更多相关文章
- poj-1207 THE 3n+1 problem
Description Problems in Computer Science are often classified as belonging to a certain class of pro ...
- poj1207 3n+1 problem
The 3n + 1 problem Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 60496 Accepted: 19 ...
- Poj1207 The 3n + 1 problem(水题(数据)+陷阱)
一.Description Problems in Computer Science are often classified as belonging to a certain class of p ...
- ACM训练计划建议(写给本校acmer,欢迎围观和指正)
ACM训练计划建议 From:freecode# Date:2015/5/20 前言: 老师要我们整理一份训练计划给下一届的学弟学妹们,整理出来了,费了不少笔墨,就也将它放到博客园上供大家参考. 菜 ...
- 【POJ水题完成表】
题目 完成情况 poj1000:A+B problem 完成 poj1002:电话上按键对应着数字.现在给n个电话,求排序.相同的归一类 完成 poj1003:求最小的n让1+1/2+1/3+...+ ...
- poj 算法 分类
转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 最近AC题:2528 更新时间:2011.09.22 ...
- POJ1008 1013 1207 2105 2499(全部水题)
做了一天水题,挑几个还算凑合的发上来. POJ1008 Maya Calendar 分析: #include <iostream> #include <cstdio> #inc ...
- POJ 水题(刷题)进阶
转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意&q ...
- ACM训练计划建议(转)
ACM训练计划建议 From:freecode# Date:2015/5/20 前言: 老师要我们整理一份训练计划给下一届的学弟学妹们,整理出来了,费了不少笔墨,就也将它放到博客园上供大家参考. 菜 ...
随机推荐
- Nginx 配置指令的执行顺序(七)
来看一个 ngx_static 模块服务磁盘文件的例子.我们使用下面这个配置片段: location / { root /var/www/; } 同时在本机的 /var/w ...
- Matlab与.NET混编解决人脸识别问题
原文 http://www.cnblogs.com/asxinyu/archive/2013/05/29/3107013.html 如果这些文章对你有用,有帮助,期待更多开源组件介绍,请不要吝啬手中的 ...
- IP地址分类与识别错误
//描述: 请解析IP地址和对应的掩码,进行分类识别.要求按照A/B/C/D/E类地址归类,不合法的地址和掩码单独归类. //所有的IP地址划分为 A,B,C,D,E五类 //A类地址1.0.0.0 ...
- [转]JSOM绘制地图区块及航道路径
From :http://support.sailstech.com/kb/c73fd2405d79911253e568ccdc69256dc7c8fb5c/josm 步驟一: 使用JOSM繪製地圖區 ...
- (译)"usermod"命令使用完全指导---15个练习例程截图
"usermod"命令使用完全指导---15个练习例程截图 By Babin Lonston Under: Linux Commands On: November 11, 2014 ...
- smb相关资料
smb相关资料 看资料就上维基 https://en.wikipedia.org/wiki/Server_Message_Block#Implementation http://www.bing.co ...
- openvpn 连接无法上网
环境:搬瓦工的vps,centos6,搬瓦工附带的openvpn服务端: 出现的问题:正常启动openvpn客户端,也正常连接服务器,但是连接之后就是没有办法上网: 我的解决办法:打开ip forwa ...
- 【位运算DFS/DLX】【HDU1426】【数独】
题意:标准的一道数独题 DFS做法: 将横纵九宫格里的数字用位运算状态压缩,且可以通过逻辑或来确定总共有哪些数字被选择了,很方便也很快,代码如下 #include <cstdio> #in ...
- HTML5新特性学习-1
本文在于巩固基础 新特性:音频的使用 <!DOCTYPE html> <html> <head lang="en"> <meta char ...
- Linux学习2——文件与目录
一.写在前面 在本节将介绍Linux下文件与目录的一些基本概念以及一些基本操作. 二.完成目标 1.了解文件和目录的一些基本概念 2.操作文件和目录的相关命令 3.文件内容查阅命令 4.文件查询命令 ...