POJ 1207(3N+1)
来源:互联网 发布:淘宝店主阿希哥 编辑:程序博客网 时间:2024/06/15 05:39
3n+1问题 果断暴力
Program P1207;var i,j,k,n,m,ans:longint;function max(a,b:longint):longint;begin if a>b then exit(a) else exit(b);end;procedure swap(var a,b:longint);var p:longint;begin p:=a; a:=b; b:=p;end;begin while not eof do begin readln(n,m); write(n,' ',m,' '); if n>m then swap(n,m); ans:=0; for i:=n to m do begin j:=1; k:=i; while (k<>1) do begin if (k mod 2=0) then k:=k div 2 else k:=k*3+1; inc(j); end; ans:=max(ans,j); end; writeln(ans); end;end.
- 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问题
- linux下C语言socket网络编程简例
- web学习—html标签—框架
- eclipse集成插件使用
- 植物大战僵尸中的经典独白
- boot memory allocator——自举内存分配器(五:停用bootmem)
- POJ 1207(3N+1)
- 上班那些事---学习flex
- 解决中文图片无法显示
- JavaScript转换与解析JSON的方法
- 这是我第一次写csdn 的blog
- Java的图片处理工具类
- 迁移工程 或 添加项目 或 修改项目名字
- Android的Handler总结
- Android中的记住密码功能与多应用的单点登录