题目链接:http://poj.org/problem?id=1207

#include <stdio.h>
#include <algorithm> using namespace std; int i,j;
int Max; int fun(int k)
{
int Count=;
while(k!=)
{
if(k%==)
k=k*+;
else k/=;
Count++;
}
return Count;
} int main()
{
while(scanf("%d%d",&i,&j)!=EOF)
{
int ti=i;
int tj=j;
Max=-;
if(ti>tj)
swap(ti,tj);
for(int k=ti; k<=tj; k++)
{
if(Max<fun(k))
{
Max=fun(k);
}
}
printf("%d %d %d\n",i,j,Max);
}
return ;
}

计算次数,POJ(1207)的更多相关文章

  1. Linux显示计算次数的结果

    Linux显示计算次数的结果 youhaidong@youhaidong-ThinkPad-Edge-E545:~$ free -c free:选项需要一个参数 -- c Usage: free [o ...

  2. OpenJudge/Poj 1207 The 3n + 1 problem

    1.链接地址: http://bailian.openjudge.cn/practice/1207/ http://poj.org/problem?id=1207 2.题目: 总时间限制: 1000m ...

  3. 时间复杂度 - Convert 计算次数 TO 时间复杂度

    我们假设计算机运行一行基础代码需要执行一次运算. int aFunc(void) { printf("Hello, World!\n"); // 需要执行 1 次 return 0 ...

  4. 字节真题 ZJ26-异或:使用字典树减少计算次数

    原题链接 题目描述: 个人分析:从输入数据看,要处理的元素个数(n)没有到达 10^9 或 10^8 级,或许可以使用暴力?但是稍微计算一下,有 10^5 * (10^5 - 1) / 2 = 10^ ...

  5. POJ 1207 3N+1 Problem

    更简单的水题,穷举法即可. 需要注意的点: 1.i 和 j的大小关系不确定,即有可能 i>j 2.即使i>j,最后输出的结果也要严格按照输出,亦即如果输入10,1,则对应输出也应为 10 ...

  6. 计算多项式Poj(1996)

    题目链接:http://poj.org/problem?id=1996 思路: 刚开始打了个二维表,调了一个小时,爆内存了. #include <stdio.h> #include < ...

  7. poj: 1207

    好吧这题竟然还有先大后小的可能,能不这么恶心下吗.. #include <iostream> #include <stdio.h> #include <string.h& ...

  8. HDOJ 1032(POJ 1207) The 3n + 1 problem

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

  9. 求x到y的最少计算次数

    链接:https://www.nowcoder.com/questionTerminal/45d04d4d047c48768543eeec95798ed6?orderByHotValue=1& ...

随机推荐

  1. 2.rabbitmq 系列教程

    rabbitmq系列教程-文章[转] 视频分享: 链接:https://pan.baidu.com/s/1s_Qr2A1o0s8Ru0exK62jqg 提取码:eb68

  2. string查找字符(串)

    在C语言中 strchr 和 strstr函数都被包含在<string.h>头文件中,也就是要调用它们时要在程序前面包含<string.h>头文件,也就是写这个语句:#incl ...

  3. (转载) win10生成SSH keys

    (转载) win10生成 SSH keys:   SSH key 可以让你在你的电脑和Code服务器之间建立安全的加密连接.  先执行以下语句来判断是否已经存在本地公钥: cat ~/.ssh/id_ ...

  4. 单一指责原则(Single Responsibility Principle) SRP

    using System; using System.Collections.Generic; using System.Text; namespace SingleResponsibilityPri ...

  5. TOJ 3635 过山车

    Description RPG girls今天和大家一起去游乐场玩,终于可以坐上梦寐以求的过山车了.可是,过山车的每一排只有两个座位,而且还有条不成文的规矩,就是每个女生必须找 个个男生做partne ...

  6. TOJ 3184 Mine sweeping

    描述 I think most of you are using system named of xp or vista or win7.And these system is consist of ...

  7. hadoop面试题一

    1.hadoop运行的原理?xxxxxx 2.mapreduce的原理?xxxxxx 3.HDFS存储的机制?xxxxxx 4.举一个简单的例子说明mapreduce是怎么来运行的 ?xxxxxx 5 ...

  8. java中json解析,xml解析

    抓取网页内容,会返回json或者xml(html)格式的数据. 为了方便的对上述两种格式的数据进行解析,可采用解析工具. JsonPath https://github.com/jayway/Json ...

  9. jqueryUI学习

    01.选项卡 拖动按钮<div id="tabs"> <ul> <li><a href="#tabs-1">第一 ...

  10. iOS instruments之ui automation的简单使用(高手绕道)

    最近使用了几次instruments中的automation工具,现记录下automation的简单使用方法,希望对没接触过自动化测试又有需求的人有所帮助.  UI 自动测试是iOS 中重要的附加功能 ...