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開發環境搭配