还以为要递归推一推的

结果暴力就过了

要注意 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. dojo.byId、dojo.query、dojo.attr

    概述: dojo.byId(/*string*/id或/*DomNode*/node) 1.传入DOMNode返回传入的domNode; 2.传入id返回id为当前值的domNode dojo.que ...

  2. 求一组数字序列的分布情况(java)

    最近需要做一个正态分布的函数图像所以要处理一段double序列 写了这个算法  先上效果图: 核心思想: 1先根据步长计算每一个区间 2循环进行判断序列中每个数属于哪个区间 3用一个数组来保存每一个区 ...

  3. codeforces #330 div2

    A: #include<cstdio> #include<algorithm> #include<cmath> #include<map> #inclu ...

  4. 设置ssh免密码登录脚本(hadoop自动化部署脚本一)

    设置ssh免密码登录脚本(hadoop自动化部署脚本一) 设置ssh免密码登录脚本(飞谷云大数据自动化部署脚本一) 1.#!/bin/sh2.#important note:this script i ...

  5. JQuery中如何动态修改input的type属性

    代码如下: jQuery(".member_id").focus(function() { jQuery(this).val(''); }).blur(function() { i ...

  6. Struts2 校验

    Struts2校验格式: actionName-methodName-invalidation.xml  该配置文件必须和action类在同一个包下. <?xml version="1 ...

  7. join函数——Gevent源码分析

    在使用gevent框架的时候,我们经常会使用join函数,如下: def test1(id): print(id) gevent.sleep(0) print(id, 'is done!') t = ...

  8. SQL Server 存储过程自启动

    前期准备: use master; create table LoginLog(LoginName nvarchar(32),LoginTime datetime); create procedure ...

  9. SSD和HDD的区别

    SSD与HDD最大的不同是:它没有马达.盘片.磁头摇臂这些HDD必需的机械部件,这是由两种硬盘不同的工作原理所决定的.SSD相比HDD来说节省了机械部件运动的时间,并且SSD所使用的主要存储元件NAN ...

  10. Delphi 常用API 函数(好多都没见过)

    AdjustWindowRect 给定一种窗口样式,计算获得目标客户区矩形所需的窗口大小AnyPopup 判断屏幕上是否存在任何弹出式窗口ArrangeIconicWindows 排列一个父窗口的最小 ...