HDU1222,HDU1032 水题
Wolf and Rabbit
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7646 Accepted Submission(s): 3844

A
rabbit must hide in one of the holes. A wolf searches the rabbit in
anticlockwise order. The first hole he get into is the one signed with
0. Then he will get into the hole every m holes. For example, m=2 and
n=6, the wolf will get into the holes which are signed 0,2,4,0. If the
rabbit hides in the hole which signed 1,3 or 5, she will survive. So we
call these holes the safe holes.
input starts with a positive integer P which indicates the number of
test cases. Then on the following P lines,each line consists 2 positive
integer m and n(0<m,n<2147483648).
1 2
2 2
YES
The 3n + 1 problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 35393 Accepted Submission(s): 12830
in Computer Science are often classified as belonging to a certain
class of problems (e.g., NP, Unsolvable, Recursive). In this problem you
will be analyzing a property of an algorithm whose classification is
not known for all possible inputs.
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 (including
the 1). 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 will consist of a series of pairs of integers i and j, one pair
of integers per line. All integers will be less than 1,000,000 and
greater than 0.
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.
You can assume that no opperation overflows a 32-bit integer.
each pair of input integers i and j you should output i, j, and the
maximum cycle length for integers between and including i and j. These
three numbers should be separated by at least one space with all three
numbers on one line and with one line of output for each line of input.
The integers i and j must appear in the output in the same order in
which they appeared in the input and should be followed by the maximum
cycle length (on the same line).
100 200
201 210
900 1000
100 200 125
201 210 89
900 1000 174
HDU1222,HDU1032 水题的更多相关文章
- HDU-1032 The 3n+1 problem 模拟问题(水题)
题目链接:https://cn.vjudge.net/problem/HDU-1032 水题 代码 #include <cstdio> #include <algorithm> ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [poj2247] Humble Numbers (DP水题)
DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
- ACM水题
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...
随机推荐
- Java学习随笔5:Java多线程编程
1. 线程是程序中单独顺序的控制流,线程本身依靠程序进行运行,线程是程序中的顺序控制流,只能使用分配给程序的资源和环境. 2. 进程是执行中的程序,一个进程可以包含一个或多个线程,但至少要包含一个线程 ...
- 【jQuery 区别】attr()和prop()的区别
1>>> 今天实现一个 点击更新按钮 ,可以勾选上本行的的checkbox的功能: 使用代码: /** * updateproduct.htmls 更新 产品信息 */ $(docu ...
- Liferay 6.2 改造系列之十八:修改登录Portlet配置,去除无用链接
在/portal-master/portal-impl/src/portal.properties文件中,有如下配置: # # Input a list of sections that will b ...
- WPF,解决Listbox,按住ListboxItem向下拖出Listbox,横向滚动条跑到最后。
类似这种样式的控件,.,在横向滚动条隐藏的情况下有这样的问题.(横向滚动条显示的时候也会,,目前不知道怎么解决.) 因为这个控件偏移是利用ListBox的ItemsPanelTemplate模版里的S ...
- wcf,socket,数据传输方式
WCF的最终目标是通过进程或不同的系统.通过本地网络或是通过Internet收发客户和服务之间的消息. WCF合并了Web服务..net Remoting.消息队列和Enterprise Servic ...
- CF#335 Sorting Railway Cars
Sorting Railway Cars time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- svn服务器端的客户端自动更新
先说这个方式的一个弊端,那就是服务器端这边代码不能与svn服务器出现冲突,一旦冲突就失效. 实现原理是,利用svn版本库,hooks目录的bat钩子开展工作. 共在hooks目录下建立3个文件如下:p ...
- android 百度地图 通过剪裁图片添加 Marker
初始化百度地图: private void initViews() { mMapView = (MapView) findViewById(R.id.bmapView); mBaiduMap = mM ...
- android 第三方 Im
1.阿里百川 单聊.群聊.客服能力集成,仅需花费4小时,不收费,0成本接入,让App轻松拥有沟通能力,历经多次双十一考验,消息到达率100%,全年可用性高达99.99%,登录异常提醒,木马钓鱼网站监测 ...
- Codeforces Round #235 (Div. 2)C、Team
#include <iostream> #include <algorithm> using namespace std; int main(){ int n,m; cin & ...