题目链接

//巨坑的一道题,输入的m,n要判断大小,输出还要按照原来的顺序,范围还是i<=n<=j

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int alro(int x) {
int ct = ;
while (x != ) {
if (x & ) x = *x+;
else x = x/;
ct++;
}
return ct;
}
int main() {
int m,n;
while (cin>>m>>n) {
int sm = min(m ,n);
int lar = max(m ,n);
int maxn = ;
for (int i=sm; i<=lar; i++) {
maxn = max(alro(i), maxn);
}
printf("%d %d %d\n", m, n, maxn);
}
return ;
}

hdoj-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. 杭电OJ——1032 The 3n + 1 problem

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

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

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

  5. Poj1207 The 3n + 1 problem(水题(数据)+陷阱)

    一.Description Problems in Computer Science are often classified as belonging to a certain class of p ...

  6. HDOJ(HDU) 2123 An easy problem(简单题...)

    Problem Description In this problem you need to make a multiply table of N * N ,just like the sample ...

  7. HDOJ 5099 Comparison of Android versions 坑题

    现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others)    Memory L ...

  8. HDU 1032 The 3n + 1 problem

    还以为要递归推一推的 结果暴力就过了 要注意 i,j 大小 #include <iostream> using namespace std; int a,b; long long cnt, ...

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

随机推荐

  1. IE浏览器连不上网,其他浏览器可以

    周末因工作需要,需用IE浏览器.结果发现IE连不上网,而其他浏览器正常上网. 首先排查不是网络连接问题. 又重启了一下网络连接.禁用---->启用. 还是不好使.(最后找到原因是DNS设置问题. ...

  2. gstreamer-tips-picture-in-picture-compositing

    http://www.oz9aec.net/index.php/gstreamer/347-more-gstreamer-tips-picture-in-picture-compositing htt ...

  3. AngularJS 视图和路由

    在AngularJS之后引用angular-route  路由   ngRoute模块加载声明   AngularJS提供的when和otherwise两个方法来定义应用的路由   otherwise ...

  4. Pytorch的gather用法理解

    先放一张表,可以看成是二维数组 行(列)索引 索引0 索引1 索引2 索引3 索引0 0 1 2 3 索引1 4 5 6 7 索引2 8 9 10 11 索引3 12 13 14 15 看一下下面例子 ...

  5. Go Concurrency or Parallel

    关于并发和并行,先看两个示例 示例1: package main import "fmt" var quit = make(chan int) func foo6(){ for i ...

  6. js学习笔记1(变量、作用域、内存)

    写在前面,舍弃叽叽歪歪,只做学习笔记,认真踏实. 学习书籍:javascript高级程序设计3版. 章节4.1 基本类型和引用类型 1.基本类型在内存中占据固定大小的空间,所以保存在栈内存中. 2.从 ...

  7. WINDOWS下好用的MongoDB 3.0以上客户端工具: NoSql Manager

      WINDOWS下好用的MongoDB 3.0以上客户端工具: NoSql Manager https://www.mongodbmanager.com/download  

  8. MongoDB快速入门(七)- Save() 方法

    MongoDB Save() 方法 save() 方法取代,通过新文档到 save()方法 语法 mongodb 的 save()方法如下所示的基本语法: >db.COLLECTION_NAME ...

  9. IntelliJ IDEA 中 右键新建时,选项没有Java class的解决方法和具体解释

    我是在别人问我的时候,才发现还可以有这个问题,主要是他新项目直接打开,什么都没配置,就打算新建文件,其实可以直接看编辑器右下角的event log,那个对话框点开的话,可以add as maven p ...

  10. XML 的解析方法

    四种XML解析方法: (1)Dom生成和解析XML文档 *解析器读入整个文档,然后构建一个驻留内存的树结构,然后代码就可以使用 DOM 接口来操作这个树结构.     * 优点:整个文档树在内存中,便 ...