The 3n + 1 problem UVA
来源:互联网 发布:洪恩软件开天辟地 编辑:程序博客网 时间:2024/06/07 13:40
问题描述:极简主义代码。
问题链接
03pie’s solution for [UVA-100]:
#include<iostream>using namespace std;int clen(int n){ int cl=1; while(n!=1){ n=(n&1?3*n+1:n>>1); cl++; } return cl;}int main(){ int a,b; while(cin>>a>>b){ int a1=a,b1=b,ans=1; if(b<a) swap(a,b); for(int i=a;i<=b;i++) ans=(ans>clen(i)?ans:clen(i)); cout<<a1<<" "<<b1<<" "<<ans<<endl; } return 0;}
阅读全文
0 0
- Uva 694 The 3n + 1 problem
- UVA 100 The 3n + 1 problem
- UVa 100 - The 3n + 1 problem
- UVa 100 - The 3n + 1 problem
- UVa 100 - The 3n + 1 problem
- uva 100 The 3n+1 problem
- UVa 100 - The 3n + 1 problem
- UVa 100 The 3n + 1 problem
- uva 100 The 3n + 1 problem
- UVa 100 The 3n + 1 problem
- UVA: The 3n + 1 problem
- UVa - The 3n + 1 problem 题解
- UVa 100 The 3n + 1 problem
- uva--100 - The 3n + 1 problem
- UVa 100 - The 3n + 1 problem
- UVa 100 - The 3n + 1 problem
- UVa 100 - The 3n + 1 problem
- Uva 17239 The 3n + 1 problem
- 用u盘装系统,进入bios后没有usb启动项怎么办
- Vijos P1335 数独验证【谜题】
- ARM的视频采集以及jpeg压缩
- android binder
- 我的C++课程设计
- The 3n + 1 problem UVA
- scp命令在两服务器间传输文件
- codeforces 632A Grandma Laura and Apples 模拟
- 出现java.sql.SQLException: No suitable driver的几种解决办法
- Angular配置Router(路由)提示Controller NaNunction/undefined错误
- 超好用的一个JQUERY分页器-jpaginate
- Spring 注入不同作用域对象
- 用集合实现学生管理系统-2
- JVM内存区域划分 (粗略认识介绍)