hdoj-1032-The 3n + 1 problem(坑题)
//巨坑的一道题,输入的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(坑题)的更多相关文章
- HDU 1032 The 3n + 1 problem (这个题必须写博客)
The 3n + 1 problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- HDU 1032.The 3n + 1 problem【注意细节】【预计数据不强】【8月21】
The 3n + 1 problem Problem Description Problems in Computer Science are often classified as belongin ...
- 杭电OJ——1032 The 3n + 1 problem
The 3n + 1 problem Problem Description Problems in Computer Science are often classified as belongin ...
- 题解报告:hdu 1032 The 3n + 1 problem(克拉兹问题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1032 Problem Description Problems in Computer Science ...
- Poj1207 The 3n + 1 problem(水题(数据)+陷阱)
一.Description Problems in Computer Science are often classified as belonging to a certain class of p ...
- 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 ...
- HDOJ 5099 Comparison of Android versions 坑题
现场赛的时候错了十四次. . ... Comparison of Android versions Time Limit: 2000/1000 MS (Java/Others) Memory L ...
- HDU 1032 The 3n + 1 problem
还以为要递归推一推的 结果暴力就过了 要注意 i,j 大小 #include <iostream> using namespace std; int a,b; long long cnt, ...
- 烟大 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 ...
随机推荐
- Spring学习笔记3—声明式事务
1 理解事务 事务:在软件开发领域,全有或全无的操作被称为事务.事务允许我们将几个操作组合成一个要么全部发生要么全部不发生的工作单元. 事务的特性: 原子性:事务是由一个或多个活动所组成的一个工作单元 ...
- SMW0 上传问题?
*SMW0 和 OAOR 的区别在哪3个方面? SMW0 上传 出现: 没有指派至MIME 类型
- 爬虫五 Beautifulsoup模块详细
一.基本使用 from bs4 import BeautifulSoup htmlCharset = "GB2312" soup=BeautifulSoup(html_doc,'l ...
- 剑指offer 面试61题
面试61题: 题目:LL今天心情特别好,因为他去买了一副扑克牌,发现里面居然有2个大王,2个小王(一副牌原本是54张^_^)...他随机从中抽出了5张牌,想测测自己的手气,看看能不能抽到顺子,如果抽到 ...
- Xshell访问kali配置
1.安装虚拟机VMware Workstation12 PRO 2.在虚拟机上安装kali2.0 3.查看liunx的ip地址ifconfig 4.端口 协议 (1)RDP协议(桌面协议)3389端口 ...
- Loadrunder之脚本篇——事务时间简介
事务概念 事务是指用户在客户端做一种或多种业务所需要的操作集(actions),通过事务开始和结束函数可以标记完成该业务所需要的操作内容(脚本section).定义事务来衡量服务器的性能,例如,你可以 ...
- $Java-json系列(一):用GSON解析Json格式数据
GSON是谷歌提供的开源库,用来解析Json格式的数据,非常好用.如果要使用GSON的话,则要先下载gson-2.2.4.jar这个文件,如果是在Android项目中使用,则在Android项目的li ...
- linux下安装mysql遇到的一些问题
安装命令: groupadd mysql useradd -r -g mysql -s /bin/false mysql cd /usr/local tar zxvf /path/to/mysql-V ...
- 【HackerRank】Find the Median(Partition找到数组中位数)
In the Quicksort challenges, you sorted an entire array. Sometimes, you just need specific informati ...
- perspective 能玩点什么
今天看又在看张鑫旭的博客,本来是在玩 transform:Matrix() 的,有讲到单个变化的矩阵设置,但多个变化的就不是那么回事了. 不过这都不是事啦,人生嘛,显然总会有些难关不是轻易能过去的,反 ...