UVa Problem 100 The 3n+1 problem (3n+1 问题)
参考:https://blog.csdn.net/metaphysis/article/details/6431937
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
ll a,b;
ll length(ll x)
{
ll l=;
while (x!=)
{
if (x%==)
{
x=*x+;
}
else
{
x=x/;
}
l++;
}
return l;
}
int main()
{
// freopen("text.txt","r",stdin);
while (scanf("%lld %lld",&a,&b)!=EOF)
{
ll ma=;
for (ll i=min(a,b);i<=max(a,b);i++)//注意输入要先排大小!
{
ma=max(ma,length(i));
}
printf("%lld %lld %lld\n",a,b,ma);
} return ;
}
UVa Problem 100 The 3n+1 problem (3n+1 问题)的更多相关文章
- UVa 100 - The 3n + 1 problem(函数循环长度)
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&pa ...
- 【转】UVa Problem 100 The 3n+1 problem (3n+1 问题)——(离线计算)
// The 3n+1 problem (3n+1 问题) // PC/UVa IDs: 110101/100, Popularity: A, Success rate: low Level: 1 / ...
- PC/UVa 题号: 110101/100 The 3n+1 problem (3n+1 问题)
The 3n + 1 problem Background Problems in Computer Science are often classified as belonging to a ...
- UVA 100 - The 3n+1 problem (3n+1 问题)
100 - The 3n+1 problem (3n+1 问题) /* * 100 - The 3n+1 problem (3n+1 问题) * 作者 仪冰 * QQ 974817955 * * [问 ...
- 100-The 3n + 1 problem
本文档下载 题目: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_pro ...
- The 3n + 1 problem
The 3n + 1 problem Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) ...
- poj1207 3n+1 problem
The 3n + 1 problem Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 60496 Accepted: 19 ...
- 杭电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 (这个题必须写博客)
The 3n + 1 problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- 烟大 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 ...
随机推荐
- 【Leetcode】【Easy】Pascal's Triangle
Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Retur ...
- Orchard Core 文档翻译 (七)Contents
CMS Modules »Contents Contents (OrchardCore.Contents) 此模块提供内容管理服务. Liquid 您可以使用“content ”属性从liquid 视 ...
- IOS NSLayoutConstraint 页面布局(通过代码添加约束)
#import "ViewController.h" @interface ViewController () @property (nonatomic, strong) UIVi ...
- 在Hibernate单向一对多关联关系中的org.hibernate.StaleStateException 异常。
具体异常如下: Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count fro ...
- Softmax实现 fashion.mnist 分类
softmax #!/usr/bin/env python # coding: utf-8 # In[1]: get_ipython().run_line_magic('matplotlib', 'i ...
- OpenCV人脸识别
import cv2 filename = 'pic.jpg' def detect(filename): face_cascade = cv2.CascadeClassifier('./haarca ...
- HDU 1205 鸽巢原理
#include <bits/stdc++.h> using namespace std; long long abs_(long long a,long long b) { if(a&g ...
- 【luogu P4711 「化学」相对分子质量】 题解
题目链接:https://www.luogu.org/problemnew/show/P4711 要细心模拟 #include <cstdio> #include <algorith ...
- Mvc5 控制器,视图简单说明
本系列会比Mvc4更详细.Mvc4记录或没记录的东西这里也会提到. 控制器 自动装配: 一般自动装配对于添加的时候比较好用 视图: 控制器返回的视图,其实就是一些静态的HTML.动态性不好,从控制器传 ...
- Vue教程:简介(一)
前言 用了这么久的vue了,但是一直没有时间写个系列文章,现在抽一定时间总结下vue的知识点. 首先,Vue 不支持 IE8 及以下版本,因为 Vue 使用了 IE8 无法模拟的 ECMAScript ...