还以为要递归推一推的

结果暴力就过了

要注意 i,j 大小

 #include <iostream>
using namespace std;
int a,b;
long long cnt,n,ans;
int main()
{
while(~scanf("%d%d",&a,&b))
{
ans=;
int p=a,q=b;
if(p>q) swap(p,q);
for(int i=p;i<=q;i++)
{
cnt=;
n=i;
while()
{
cnt++;
if(n==) break;
if(n%) n=*n+;
else n/=;
}
if(cnt>ans) ans=cnt;
}
printf("%d %d %ld\n",a,b,ans);
}
}
//dp[i]=dp[3*i+1]+1;
//dp[i]=dp[i/2]+1;

HDU 1032 The 3n + 1 problem的更多相关文章

  1. HDU 1032 The 3n + 1 problem (这个题必须写博客)

    The 3n + 1 problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Other ...

  2. HDU 1032.The 3n + 1 problem【注意细节】【预计数据不强】【8月21】

    The 3n + 1 problem Problem Description Problems in Computer Science are often classified as belongin ...

  3. 题解报告:hdu 1032 The 3n + 1 problem(克拉兹问题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1032 Problem Description Problems in Computer Science ...

  4. 杭电OJ——1032 The 3n + 1 problem

    The 3n + 1 problem Problem Description Problems in Computer Science are often classified as belongin ...

  5. 烟大 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 ...

  6. UVa 100 - The 3n + 1 problem(函数循环长度)

    题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&pa ...

  7. The 3n + 1 problem 分类: POJ 2015-06-12 17:50 11人阅读 评论(0) 收藏

    The 3n + 1 problem Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 53927   Accepted: 17 ...

  8. uva----(100)The 3n + 1 problem

     The 3n + 1 problem  Background Problems in Computer Science are often classified as belonging to a ...

  9. 【转】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 / ...

随机推荐

  1. ADT "Running Android Lint" has encountered a problem

    解决办法: Window--->Preferences----->Android--------> LInt Error Checking----->when saving f ...

  2. Springmvc和velocity使用的公用后台分页

    Springmvc和velocity使用的公用后台分页 类别                    [选择一个类别或键入一个新类别] Springmvc和velocity使用的公用后台分页 样式: 使 ...

  3. css权重计算

    第一等:代表内联样式,如: style=””,权值为1000.    第二等:代表ID选择器,如:#content,权值为100.    第三等:代表类,伪类和属性选择器,如.content,权值为1 ...

  4. Android开发_关于如何屏蔽Home键

    今天在遇到一个要屏蔽Home键的问题,研究一上午终于解决,方法记录于下: 在Android2.3版本以下重写以下方法就能屏蔽Home键: public void onAttachedToWindow( ...

  5. python-整理-面向对象

    python的类和perl的类有相似之处,类的方法的第一个参数是表示类的对象自己,相当于c#的this python中定义类 class person: ''示例类,人'' count=0; def ...

  6. php 记住密码自动登录

    当我们登录网站管理后台的时候,会有提示说记住登录状态,记住我等这样的提示,这个选项有什么用呢?如果选中了记登录状态后,下次在浏览这个网站后 台时就不用在填写用户名和密码了,在去登录了.下面写了一小代码 ...

  7. [Non-original]OS X How do I unset an IP address set with ifconfig?

    I recently used ifconfig en1 1.2.3.4 to set the IP address of a network interface (specifically, the ...

  8. SQL Server 的各种查询和要申请的锁

    前期准备: 1.建表 create table T_Btree(X int primary key,Y nvarchar(4000));            create table T_Heap( ...

  9. 【python】中文的输出,打印,文件编码问题解决方法

    直接在python中输入中文的字符串会报编译错误SyntaxError: Non-ASCII character,因为python文件默认编码方式是ASCII.如果想要打印中文字符,有两种方式: 1. ...

  10. 【Linux CentOS 在虚拟机中XShell出现: (port 22): Connection failed.】

    原因:没安装openssh-server组件!!!!!!!!!! 解决办法:yum install openssh-server 查看openssh-server是否启动: $:ps -ef |gre ...