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

打表记忆化。

  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int n;
  6. int dp[];
  7. int dfs(int n) {
  8. if(n==)
  9. return ;
  10. if(dp[n]>)
  11. return dp[n];
  12. int cnt=;
  13. for(int i=;i<=n;i++) {
  14. if(n%i==)
  15. cnt+=dfs(n/i);
  16. }
  17. return dp[n]=cnt;
  18. }
  19.  
  20. int main()
  21. {
  22. memset(dp,,sizeof(dp));
  23. scanf("%d",&n);
  24. printf("%d\n",dfs(n));
  25.  
  26. return ;
  27. }

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. win7旗舰版+caffe+vs2013+matlab2014b(无GPU版)

    参考网站: http://www.cnblogs.com/njust-ycc/p/5776286.html 无法找到gpu/mxGPUArray.h: No such file or director ...

  2. java动态数组笔记

    动态数组: 在java.lang.reflect包下提供了Array类,包括一系列static方法,通过这些方法可动态的创建数组.给元素赋值.取出元素值等等 //理解数组引用——下面定义的objs数组 ...

  3. vue中this.$router.push() 传参

    1  params 传参 注意⚠️:patams传参 ,路径不能使用path 只能使用name,不然获取不到传的数据 this.$router.push({name: 'dispatch', para ...

  4. vue2.0组件的生命周期

    beforeCreate(){ console.log(new Date().getTime()) let data = this.text; console.log('组件创立之前') consol ...

  5. 基于MVC模式开发的后台框架

    1.ThinkCMF 2.NFine快速开发平台 3.力软快速开发框架 如有好的开发框架希望可以一起交流

  6. Robot Framework搭建

    需要安装的内容如下: 1. Python2.7.13(听说python3对RF支持的不是很好,所以我下的Python2) 2. wxPython 2.8.12.1(只能这个版本) 3. robotfr ...

  7. Elasticsearch简单运算

    求平均数 { "query": { "bool": { "must": [ { "term": { "stor ...

  8. 读<<programming ruby>> 7.6节 flip-flop 理解

    书中源码是这样的 File.foreach('1.txt') do |x| if(($. == 1) || x =~ /eig/) .. (($. == 3) || x =~ /nin/) then ...

  9. DEDE会员注册邮件验证时,用户无法收到邮件的解决方法

    本文以qq邮箱.163邮箱和易网库提供的企业邮箱为例,简要介绍在织梦(DEDECMS)中设置SMTP验证发送邮件的方法 一.在织梦中使用qq邮箱发送邮件 1.在织梦中使用qq邮箱发送邮件, 需要确保q ...

  10. Python文本数据分析与处理

    Python文本数据分析与处理(新闻摘要) 分词 使用jieba分词, 注意lcut只接受字符串 过滤停用词 TF-IDF得到摘要信息或者使用LDA主题模型 TF-IDF有两种 jieba.analy ...