bzoj 1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏【模拟】
模拟
#include<iostream>
#include<cstdio>
using namespace std;
int n,ans;
int main()
{
scanf("%d",&n);
for(;n>1;ans++)
{
if(n&1)
n=n*3+1;
else
n>>=1;
}
printf("%d\n",ans);
return 0;
}
bzoj 1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏【模拟】的更多相关文章
- bzoj:1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏
Description 奶牛们又在玩一种无聊的数字游戏.输得很郁闷的贝茜想请你写个程序来帮她在开局时预测结果.在游戏的开始,每头牛都会得到一个数N(1<=N<=1,000,000).此时奶 ...
- BZOJ 1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏 幼儿园测试题
本来以为是一道数学题,一顿XJBT导式子,结果就是个幼儿园都会的模拟. Code: #include<bits/stdc++.h> #define ll long long using n ...
- 【BZOJ】1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏(刷水严重)
http://www.lydsy.com/JudgeOnline/problem.php?id=1666 这种我就不说了.. #include <cstdio> #include < ...
- 【BZOJ】1666 [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏
[算法]贪心&&堆 [题解]反过来看就是合并任意两块木板,花费为木板长度之和. 显然从最小的两块开始合并即可,用堆(优先队列)维护. 经典DP问题石子归并是只能合并相邻两堆石子,所以不 ...
- BZOJ1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏
1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 5 ...
- BZOJ 1669: [Usaco2006 Oct]Hungry Cows饥饿的奶牛( LIS )
裸的LIS ----------------------------------------------------------------- #include<cstdio> #incl ...
- 【BZOJ】3404: [Usaco2009 Open]Cow Digit Game又见数字游戏(博弈论)
http://www.lydsy.com/JudgeOnline/problem.php?id=3404 写挫好几次.... 裸的博弈论即可.. #include <cstdio> #in ...
- bzoj 1669: [Usaco2006 Oct]Hungry Cows饥饿的奶牛【dp+树状数组+hash】
最长上升子序列.虽然数据可以直接n方但是另写了个nlogn的 转移:f[i]=max(f[j]+1)(a[j]<a[i]) O(n^2) #include<iostream> #in ...
- BZOJ1669: [Usaco2006 Oct]Hungry Cows饥饿的奶牛
1669: [Usaco2006 Oct]Hungry Cows饥饿的奶牛 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 665 Solved: 419 ...
随机推荐
- jmap Unable to open socket file解决
pid:Unable to open socket file: target process not responding or HotSport VM not loadedThe -F option ...
- ZOJ 2561 Order-Preserving Codes
Order-Preserving Codes Time Limit: 5000ms Memory Limit: 65536KB This problem will be judged on ZJU. ...
- python 安装依赖几个问题---HttpScan
https://blog.csdn.net/chenggong2dm/article/details/61923420 https://www.cnblogs.com/caochuangui/p/59 ...
- 【Nginx】负载均衡-IP哈希策略剖析
转自:江南烟雨 IP哈希初始化 IP哈希的初始化函数ngx_http_upstream_init_ip_hash(ngx_http_upstream_ip_hash_module.c): static ...
- Android studio 插件之 GsonFormat (自己主动生成javabean)
概述 相信大家在做开发的过程中都写过非常多的javabean ,非常多情况下 都是一个列表数据就是一个单独的javabean.假设大家自己敲的话费时费力 还非常easy敲错. 今天给大家推荐一个插件 ...
- Hdu2111
<span style="color:#6600cc;">/* J - Saving HDU Time Limit:1000MS Memory Limit:32768K ...
- NHibernate之旅(8):巧用组件之依赖对象
本节内容 引入 方案1:直接加入 方案2:巧用组件 实例分析 结语 引入 通过前面7篇的学习,有点乏味了~~~这篇来学习一个技巧.大家一起想想假设我要在Customer类中实现一个Fullname属性 ...
- 2016/1/1 运算符 笔记整理 接2015/12/30 Java 语法
④运算符 1,赋值运算符:实现从右向左的赋值,符号= 2,算术运算符:符号 + - * / %(求余或求模),结果自动转成最大的 类型,自动升级. 3, 比较 ...
- 【OI】单调队列
所谓单调队列,就是一个保持着某种性质的队列,通常是队列从队头到队尾,维护一种递增递减的关系. 这种队列通常用来解决一些连续区间的最值问题. 这种队列的入队要保证符合当前的性质,例如一个递增的单调序列( ...
- 关于The hierarchy of the type TestBeforeAdvice is inconsistent的问题
今天准备写一个spring aop的demo,创建了TestBeforeAdvice类,该类实现了MethodBeforeAdvice接口,eclipse报了"The hierarchy o ...