poj 1207 3n+1
来源:互联网 发布:淘宝达人有什么用 编辑:程序博客网 时间:2024/05/19 12:25
#include <stdio.h>int count(int x){int value = 0;if(x == 1)return 1;else{while(x != 1){if(x%2 == 0)x /=2;elsex = 3*x + 1;value++;}}return value+1;}int main(){int i,j;while((scanf("%d %d",&i,&j)) != EOF){int temp_i = i,temp_j = j;if(i > j){int temp;temp = i;i = j;j = temp;}int max_sum = -1,temp_sum = -1;int k;for(k=i;k<=j;k++){temp_sum = count(k);if(temp_sum >max_sum)max_sum = temp_sum;}printf("%d %d %d\n",temp_i,temp_j,max_sum);}return 0;}
- POJ 1207(3N+1)
- poj 1207 3n+1
- poj 1207 The 3n + 1 problem
- POJ 1207 The 3n + 1 problem
- poj 1207 The 3n + 1 problem
- POJ 1207 The 3n + 1 problem
- poj 1207 The 3n + 1 problem
- POJ 1207 - The 3n + 1 problem
- POJ 1207 The 3n + 1 problem
- POJ 1207 The 3n + 1 problem
- The 3n+1 problem POJ 1207
- POJ 1207 The 3n + 1 problem
- POJ 1207: The 3n+1 problem
- The 3n + 1 problem(POJ--1207
- POJ-1207 The 3n + 1 problem
- The 3n + 1 problem POJ 1207
- [POJ]1207 The 3n + 1 problem
- POJ 1207 3n+1问题
- Install Greenplum Hadoop on VirtualBox 4.2 + centos 6.2
- android---利用反射实现的屏幕录制技术
- Android 开发之多线程处理、Handler 详解
- linux下破解Python集成开发环境WingIDE4.1,以及使用PyCharm的使用
- GPT转MBR分区格式图文教程
- poj 1207 3n+1
- 嵌入式经典笔试题-----不看后悔啊
- XP下,文件夹添加右键命令行
- PowerDesigner15使用时的十五个问题
- 按钮形状---超链接
- HDU 2966 模板题
- Java乔晓松-android activity横竖屏切换
- ofbiz入门及安装
- Linux知识:为什么要用字符~来表示home目录