还以为要递归推一推的

结果暴力就过了

要注意 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. javascript模式——Decorator

    Decorator 模式是一种结构型模式,他意在促进代码的复用,是塑造子类的一个方式. 这种想法是基于,新增的属性,对于对象来说不是必须的基本功能.我们为特殊的对象添加自己的方法,而不是重新创建一个类 ...

  2. DWZ在APS.NET WebForm中的使用(二)

    任何框架由于个人理解不到位或者框架自身的局限性,在项目实施中,大家或多或少都会遇到一些问题,下面我就讲述下我在使用DWZ开发过程中的几个问题.如有一点能帮助到你,这篇文章也算有存在的意义了. 1.树菜 ...

  3. OC准备知识

    #import 与 #include区别 include完成头文件的导入,可能会导致头文件的相互引用和函数或变量的重复定义 为了解决这个问题 我们必须这样做 #ifndef Student_h #de ...

  4. 3D模型制作

    agisoft: http://www.agisoft.com/downloads/installer/ http://pan.baidu.com/s/1dDwA3tf http://pan.baid ...

  5. AngularJS 之Services讲解

    Angular带来了很多类型的services.每个都会它自己不同的使用场景.我们将在本节来阐述. 首先我们必须记在心里的是所有的services都是singleton(单例)的,这也是我们所希望得到 ...

  6. Cannot initialise keyboard run ./nano-X

    其中之一解决方案为: ./xinit

  7. Leetcode 171 Excel Sheet Column Number python

    题目: Given a column title as appear in an Excel sheet, return its corresponding column number. For ex ...

  8. Django 1.6 基于类的通用视图

    Django 1.6 基于类的通用视图 最初 django 的视图都是用函数实现的,后来开发出一些通用视图函数,以取代某些常见的重复性代码.通用视图就像是一些封装好的处理器,使用它们的时候只须要给出特 ...

  9. pyinstaller打出的EXE包执行时报错“failed to excute ”信息

    我的程序是selenium自动化脚本,打包时执行的是 Python pyinstaller -F --onefile -w  XXX.py 这样打出的包执行后提示“failed to excute s ...

  10. Android上使用OpenglES2.0遇到的一点问题

    按照教程开发OpenglES2.0应用,遇到Logcat报错“Called unimplemented OpenGL ES API” 在论坛和stackoverflow上找到了答案. 1.manife ...