从 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. environment与@ConfigurationProperties的关系 加载过程分析

    environment是在printBanner之前就初始化好了, 更在context创建之前, 已经加载application-xxxx.properties, System.properties, ...

  2. 5-----BBS论坛

    BBS论坛(五) 5.1.cms后台修改密码功能完成 (1)新建app/forms.py # app/forms.py from wtforms import Form class BaseForm( ...

  3. my.副本

    梦幻西游手游 天蓬下凡 副本 第三关:天蓬终于决定要告白了,主怪大唐,护卫狮驼岭,帮凶是龙宫,打过这关也很简单. 第四关:康太尉找来了天兵,怪仍然是有法有攻,但是打起来也是不难. ZC: 姚太尉是物理 ...

  4. Dev Express Report 学习总结(四)Dev Express 动态生成XRTable使用总结

    1. XRTableCell常见属性  XRTableCell xrTableCell = new XRTableCell(); A. 字体及字体大小 xrTableCell.Font = new S ...

  5. RTT设备驱动之看门狗

    看门狗的喂狗一般放在空闲任务钩子函数里面. rt_thread_idle_sethook(idle_hook); static void idle_hook(void) { /* 在空闲线程的回调函数 ...

  6. bootstrap3-dialog:更强大、更灵活的模态框(封装好的模态框)

    用过bootstrap框架的同学们都知道,bootstrap自带的模态框用起来很不灵活,可谓鸡肋的很.但nakupanda开源作者封装了一个更强大.更灵活的模态框——bootstrap3-dialog ...

  7. Murano Weekly Meeting 2016.06.21

    Meeting time: 2016.June.21 1:00~2:00 Chairperson:  Kirill Zaitsev, from Mirantis Meeting summary: 1. ...

  8. 给用户添加sodu权限

    vim /etc/sudoers 进入编辑模式,找到这一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(这里的 ...

  9. Windows 2008 R2 防火墙允许Serv-U通过的方法

    在Windows 2008 R2上安装了Serv-U FTP服务端软件之后,无法通过客户端连接,究其原因是Windows 2008的防火墙没有开启FTP端口,而且在防火墙上添加Serv-U程序也不行, ...

  10. Html+CSS二周目--->常用概念

    学习css几乎俩周,来总结一下 对于初学者来说,有一些基本的概念是我们应当清楚的.掌握这些概念,可以帮助你更加有效的开发,大大提高开发效率. 1.盒子模型 2.浮动(float) 3.定位(posit ...