还以为要递归推一推的

结果暴力就过了

要注意 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. Windows7中安装内存与可用内存不一致的解决办法

    转载:http://blog.sina.com.cn/s/blog_56741a420100h9d1.html 问题现象: 安装完Windows7后,在计算机->属性中,会看到安装内存.但有时在 ...

  2. oracle spoof用法

    关于SPOOL(SPOOL是SQLPLUS的命令,不是SQL语法里面的东西.) 对于SPOOL数据的SQL,最好要自己定义格式,以方便程序直接导入,SQL语句如: select taskindex|| ...

  3. 【转】GATT Profile 简介

    网上关于讲解 BLE 的内容比较少,看到这篇文章写的非常详细 Introduction to Bluetooth Low Energy,作为 BLE 的入门时介绍是非常合适的.本文主要翻译了一下这篇文 ...

  4. Eclipse导入jre方法

    处理步骤:引入本机安装的jre1.8的步骤如下:

  5. inux中tail命令---用于查看文件内容

    linux中tail命令---用于查看文件内容 最基本的是cat.more和less.1. 如果你只想看文件的前5行,可以使用head命令,如:head -5 /etc/passwd2. 如果你想查看 ...

  6. jquery-练习-折叠效果

    <!DOCTYPE html > <html xmlns="http://www.w3.org/1999/xhtml"> <head> < ...

  7. 安装windows7和ubuntu双系统后引导项设置

    win7系统,U盘安装ubuntu,在选择[安装启动引导器的设备]时,1.如果你选择的是/dev/sda,即整个硬盘,他会将启动引导器使用grub进行系统引导,而不再使用windows loader, ...

  8. C++中的类和对象(二)

    一,对象的动态建立和释放 1.什么是对象的动态建立和释放 通常我们创建的对象都是由C++编译器为我们在栈内存中创建的,我们无法对其进行生命周期的管理.所以我们需要动态的去建立该对象,因此我们需要在堆内 ...

  9. python交换两个变量的值,一句代码搞定

    a = 10 b = 20 # 不需要中间变量,一步搞定 a, b = b, a

  10. 使用微软的(how-old.net)构建智能门店管理系统

    现在是大数据时代,每个企业都要对自己的客户有全面的认识,这样才能最准确的分析客户,做出相应的决策.在实体的门店中,对于客户的管理还是比较低级,很多客户对于企业来说是哑终端,即对于企业来说,完全不知道客 ...