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


目录
相关文章
|
7月前
|
Java 网络安全 Maven
简记:一个flutter构建错误A problem occurred configuring project ‘:smart_auth‘. > Could not res
简记:一个flutter构建错误A problem occurred configuring project ‘:smart_auth‘. > Could not res
427 0
|
Linux 开发工具 Android开发
[√]leak tracer的stack address始终无法被addr2line识别
[√]leak tracer的stack address始终无法被addr2line识别
151 0
|
数据库 数据库管理
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
【异常解决】svn报“Previous operation has not finished; run ‘cleanup‘ if it was interrupted”的错误解决方案
618 0
|
SQL Oracle 数据可视化
译|Thinking Clearly about Performance (Part 1)(下)
译|Thinking Clearly about Performance (Part 1)(下)
110 0
|
Rust 小程序
小程序警告:Now you can provide attr wxkey for a wxfor to improve performance
首先,无论什么程序,控制台中的警告都是会影响程序性能的。我们需要减少此类警告的出现,以提高程序的运行性能。 小程序开发的时候,遇到了如下的警告:
170 0
|
SQL 资源调度 Oracle
译|Thinking Clearly about Performance (Part 2)(下)
译|Thinking Clearly about Performance (Part 2)(下)
50 0
|
存储 Oracle 关系型数据库
译|Thinking Clearly about Performance (Part 1)(上)
译|Thinking Clearly about Performance (Part 1)
78 0
|
测试技术
loadrunner 技巧-模拟Run Logic中的随机Action运行
loadrunner 技巧-模拟Run Logic中的随机Action运行
99 0
|
编解码 并行计算
wrf--运行real.exe时报错:“Could not find level above ground“ error
在修改wrf初始场资料时,如果做了带通滤波处理,会发现在运行real.exe时报错:“Could not find level above ground” error 。
wrf--运行real.exe时报错:“Could not find level above ground“ error
|
异构计算
Quartus中出现错误: Can't place multiple pins assigned to pin location Pin_101 (IOPAD_X53_Y21_N14)
Quartus中出现错误: Can't place multiple pins assigned to pin location Pin_101 (IOPAD_X53_Y21_N14)
544 0
Quartus中出现错误: Can't place multiple pins assigned to pin location Pin_101 (IOPAD_X53_Y21_N14)