ZOJ 2722 Head-to-head match
来源:互联网 发布:如何从icloud恢复数据 编辑:程序博客网 时间:2024/06/06 01:56
刚开始由于溢出tle...
#include <iostream>using namespace std;int main(){int n;while(cin>>n&&n!=0){int times=0;while(n!=1){times++;if(n%2!=0)n=n/2+1;elsen/=2;}cout<<times<<endl;}return 0;}后改为n=n/2+1; AC
另外while(n!=1)最好改为while(n>1)....若为0,内部改为0,陷入死循环!
0 0
- zoj 2722 Head-to-Head Match
- ZOJ 2722 Head-to-Head Match
- ZOJ 2722 Head-to-head match
- zoj 2722 Head-to-Head Match
- zoj 2722 Head-to-Head Match (睡前一水~)
- ZOJ Problem Set - 2722 Head-to-Head Match
- ZOJ2722Head-to-Head Match
- head
- head
- head
- head
- HEAD
- HEAD
- My first head to Blog
- PHP and ASP.NET Go Head-to-Head
- JavaServer Faces vs tapestry a head-to-head comparision
- Git HEAD & head
- Git HEAD^与HEAD~
- xp0wm7.hengxinmuju.comyoujizhuoduncanyunwei
- 谈谈我做过的关键词聚类
- 如何更深入地学习 Linux?
- 游戏人生(二),有一种东西叫CCScrollView
- KMP算法
- ZOJ 2722 Head-to-head match
- 关于抽象类
- 秒 毫秒 微秒 纳秒 皮秒
- 虚拟机搭建hadoop的全分布式集群-in detail (2)
- 用GDB 调试Java程序
- OpenGL位图操作
- “模”法无边-设计模式6
- malloc函数和new
- vfprintf、vprintf和vsprintf函数