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));
    }
}


目录
相关文章
|
数据库
面向失败的设计-Planning for failure
这篇文章,将会介绍如何把结构化状况以及应对方式,从而得以以系统地方式沉淀积累,成为可复用的预案;最后,文章会结合阿里巴巴10年大促的实践,给出实践预案的原则性建议。
1689 0
|
11月前
|
Rust 小程序
小程序警告:Now you can provide attr wxkey for a wxfor to improve performance
首先,无论什么程序,控制台中的警告都是会影响程序性能的。我们需要减少此类警告的出现,以提高程序的运行性能。 小程序开发的时候,遇到了如下的警告:
159 0
Optimization loop failed: Cancelled: Operation was cancelled解决方案
Optimization loop failed: Cancelled: Operation was cancelled解决方案
331 0
Optimization loop failed: Cancelled: Operation was cancelled解决方案
|
索引
问题复盘:Kibana did not load properly. Check the server output for more information
问题复盘:Kibana did not load properly. Check the server output for more information
422 0
问题复盘:Kibana did not load properly. Check the server output for more information
|
PyTorch 算法框架/工具 Windows
【Windows pytorch-gpu环境】RuntimeError: Attempt to start a new process before the current process has
【Windows pytorch-gpu环境】RuntimeError: Attempt to start a new process before the current process has
209 0
|
容器 安全 物联网
Speed Matters: How To Process Big Data Securely For Real-time Applications
Big Data processing has stepped up to provide organizations with new tools and technologies to improve business efficiency and competitive advantage.
1308 0
Speed Matters: How To Process Big Data Securely For Real-time Applications