Gym 100090D Insomnia
从 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的更多相关文章
- 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 ...
- ACM: Gym 101047K Training with Phuket's larvae - 思维题
Gym 101047K Training with Phuket's larvae Time Limit:2000MS Memory Limit:65536KB 64bit IO F ...
- ACM: Gym 101047E Escape from Ayutthaya - BFS
Gym 101047E Escape from Ayutthaya Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I6 ...
- ACM: Gym 101047B Renzo and the palindromic decoration - 手速题
Gym 101047B Renzo and the palindromic decoration Time Limit:2000MS Memory Limit:65536KB 64 ...
- Gym 101102J---Divisible Numbers(反推技巧题)
题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an a ...
- Gym 100917J---Judgement(01背包+bitset)
题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury ...
- Gym 100917J---dir -C(RMQ--ST)
题目链接 http://codeforces.com/gym/100917/problem/D problem description Famous Berland coder and IT mana ...
- Gym 101102D---Rectangles(单调栈)
题目链接 http://codeforces.com/gym/101102/problem/D problem description Given an R×C grid with each cel ...
- Gym 101102C---Bored Judge(区间最大值)
题目链接 http://codeforces.com/gym/101102/problem/C problem description Judge Bahosain was bored at ACM ...
随机推荐
- HikariPool连接池的使用
HikariDataSource datasource= new HikariDataSource( xxxx ); Connection cn = datasource.getConnection( ...
- POI 读大文件日志
POI的三个目录 usermodel 包含很多类,方便用户使用,但是占用内存大 eventusermodel 使用xml的SAX事件解析,XSSFReader创建时必须使用OPCPackage,pkg ...
- CVE-2015-1635(MS15-034 )进行DOS攻击
上一篇的文章方法进行检测漏洞是否存在,接着我们搭建win2008进行DOS攻击测试,导致服务器蓝屏,异常关机. 靶机:windows2008 IIS7.0 192.168.31.91 攻 ...
- PHP、thinkPHP5.0开发网站文件管理功能(二)删除文件
1.is_dir():检查指定的文件是否是目录 2.scandir():返回指定目录中的文件和目录数组 3.unlink():删除文件,如果删除的文件不存在会报错,加@抑制报错 public func ...
- ajax动态给select赋值
<select name="elements" id="ele" style="width: 145px;"> ...
- inventor安装失败怎样卸载安装inventor 2015?
AUTODESK系列软件着实令人头疼,安装失败之后不能完全卸载!!!(比如maya,cad,3dsmax等).有时手动删除注册表重装之后还是会出现各种问题,每个版本的C++Runtime和.NET f ...
- Surface Shader(表面着色器)
Shader "Custom/Surface_Shadeer" { Properties { ...
- Mongodb installation & userguide
1.Mongodb Installation in Ubuntu (1) Download from: https://www.mongodb.org/downloads File: mongodb- ...
- (转)DNS原理及其解析过程
DNS原理及其解析过程原文:http://blog.51cto.com/369369/812889 网络通讯大部分是基于TCP/IP的,而TCP/IP是基于IP地址的,所以计算机在网络上进行通讯时只能 ...
- shell脚本的使用
$# 返回命令行参数个数 $n 接受终端指定位置参数 $* 接受终端所有参数(不包含 $0) $@ 接受终端所有参数(不包含 $0,在for循环时和 $* 的表现有差异) $? 返回上一次程 ...