从 n 变到 1,有多少种方案?

打表记忆化。

 #include <bits/stdc++.h>

 using namespace std;

 int n;
int dp[];
int dfs(int n) {
if(n==)
return ;
if(dp[n]>)
return dp[n];
int cnt=;
for(int i=;i<=n;i++) {
if(n%i==)
cnt+=dfs(n/i);
}
return dp[n]=cnt;
} int main()
{
memset(dp,,sizeof(dp));
scanf("%d",&n);
printf("%d\n",dfs(n)); return ;
}

Gym 100090D Insomnia的更多相关文章

  1. ACM: Gym 101047M Removing coins in Kem Kadrãn - 暴力

     Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Fo ...

  2. ACM: Gym 101047K Training with Phuket's larvae - 思维题

     Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO F ...

  3. ACM: Gym 101047E Escape from Ayutthaya - BFS

    Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I6 ...

  4. ACM: Gym 101047B Renzo and the palindromic decoration - 手速题

     Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64 ...

  5. Gym 101102J---Divisible Numbers(反推技巧题)

    题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an a ...

  6. Gym 100917J---Judgement(01背包+bitset)

    题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury ...

  7. Gym 100917J---dir -C(RMQ--ST)

    题目链接 http://codeforces.com/gym/100917/problem/D problem description Famous Berland coder and IT mana ...

  8. Gym 101102D---Rectangles(单调栈)

    题目链接 http://codeforces.com/gym/101102/problem/D problem  description Given an R×C grid with each cel ...

  9. Gym 101102C---Bored Judge(区间最大值)

    题目链接 http://codeforces.com/gym/101102/problem/C problem description Judge Bahosain was bored at ACM ...

随机推荐

  1. mongodb在windows下安装

    下载地址:https://www.mongodb.com/download-center/community 我下载的是zip版本 新建目录:data |_db |_log cmd到所下载的mongo ...

  2. spring aop execution用法

    代码结构: 1. "execution(* com.ebc..*.*(..))" 与 "execution(*  com.ebc..*(..))" 2019-0 ...

  3. matlab的一些关于块分类的函数~~~

    1. nlfilter(General sliding-neighborhood operations) B = nlfilter(A, [m n], fun),这是一个其中A是图像[m  n]是图像 ...

  4. Linux平台命令挂载U盘——实现数据共享

    废话少说,一一道来,Linux中按照步骤来做就可以啦.(嵌入式平台) 1.先看看本地的mount信息 # mountrootfs on / type rootfs (rw)/dev/root on / ...

  5. TouchSlide 触屏滑动特效插件

    TouchSlide 是纯javascript打造的触屏滑动特效插件,面向手机.平板电脑等移动终端,能实现触屏焦点图.触屏Tab切换.触屏多图切换等常用效果. 插件开源.体积小.简单实用.功能强大,是 ...

  6. Machine learning preface

    Machine learning Preface Definition T: Task E: Experience P: Performance Sequence: T -> E -> P ...

  7. jenkins构建&发布git托管的VS工程

    顺便做个笔记,以防以后再踩坑:笔者用的是jenkins-1.620和git-2.7.2-64-bit.exe,操作系统是win10(本机) jenkins安装完成之后 如果想要配合git完成拉取代码. ...

  8. js动态控制导航栏样式

    导航栏一般做为母版页,为了使增加用户体验,往往在用户进入某个页面给予导航栏相应的样式,这里可以用js动态添加 <div class="box_left fl"> < ...

  9. 关于web.xml的welcome-file-list 配置与tomcat的关系:

    关于web.xml的welcome-file-list 配置与tomcat的关系: 2018年04月18日 10:17:13 守望dfdfdf 阅读数:377 标签: welcome-file-lis ...

  10. Deloyment Descriptor Web.xml Analysis

    https://javaee.github.io/tutorial/webapp003.html Web.xml详解分析: 该web.xml文件包含Facelets应用程序所需的几个元素.使用NetB ...