11384 - Help is needed for Dexter 模拟 98
分治法
/* author:jxy lang:C/C++ university:China,Xidian University **If you need to reprint,please indicate the source** */ #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> using namespace std; int org[10001]; int f(int now) { if(now>10000) return f(now>>1)+1; if(org[now])return org[now]; return org[now]=f(now>>1)+1; } int main() { int n; memset(org,0,sizeof(org)); org[1]=1; while(~scanf("%d",&n)) { printf("%d\n",f(n)); } }
最后更新:2017-04-03 15:22:09
上一篇:
Java面向对象高级--实例分析—宠物商店
下一篇:
Core Data多线程环境下pendingChange引发的排序不对问题
cocos2d-x中Node与Node层级架构
Core Data浅谈系列之七 : 使用NSFetchedResultsController
2017年值得关注的数据中心趋势预测
Siri之父揭秘人工智能产品如何成功创造千亿市场
翘首期盼247天!《阿里巴巴Java开发手册》扫描插件正式发布
机房收费系统——VB将MSHflexgrid控件中的数据导出为Excel
MOM系列文章之 - Final Consistency 讨论
Android3.0版本以上出现android.os.NetworkOnMainThreadException异常与处理方式
Using Container Service to Build WeChat Applets
【转载】Ubuntu Android开发环境搭配