hdu 4472 Count
递推,一般的dp值:
#include<stdio.h>
#include<string.h>
#define mod 1000000007
int a[];
int Dp()
{
a[]=;
a[]=;
for(int i=;i<=;i++)
{
for(int j=;j<i;j++)
{
if((i-)%j==)a[i]+=a[j];
a[i]%=mod;
}
}
return ;
}
int main()
{
int n;
int cas=;
Dp();
while(scanf("%d",&n)!=EOF)
{
printf("Case %d: ",cas++);
printf("%d\n",a[n]);
}
return ;
}
hdu 4472 Count的更多相关文章
- hdu 4472 Count(递推即dp)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4472 代码: #include <cstdio> #include <cstring ...
- HDU 4472 Count(数学 递归)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4472 Problem Description Prof. Tigris is the head of ...
- hdu 4472 Count (递推)
Count Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Subm ...
- hdu 4472 Count (2012 ACM-ICPC 成都现场赛)
递推,考虑到一n可以由i * j + 1组合出来,即第二层有j个含有i个元素的子树...然后就可以了.. #include<algorithm> #include<iostream& ...
- [dp] hdu 4472 Count
意甲冠军: 鉴于n节点,满足子节点的相同的树节点号的同一层较少不同的形式. 思考: dp[i][j] 代表i节点.最后,一个层j方法节点 由于满足同层节点,所以j一层又一层必须是j 整数倍 所以就能得 ...
- HDU 4472 Count DP题
解题报告:题目大意,给你n个球,要将这n个球从下到上按层次排列,要求同一个层次的的每一个分支的数量都必须相等,问有多少种排列的方法. 此题的一个DP题,假设现在有n个球,要将这n个球排列好,我们就必须 ...
- HDU 4472 Count (DP)
题目:问n个节点构成完全对称的树有多少种方法. 因为树是完全对称的,所以它的子树也是完全对称的. 对于每个树,拿出一个根节点,枚举剩下的节点能拆分成多少个子树. #include <cstdio ...
- HDU 3336 Count the string(KMP的Next数组应用+DP)
Count the string Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- hdu 4472 dp
http://acm.hdu.edu.cn/showproblem.php? pid=4472 第一个本能的找规律.第二直觉 树被分成的子树,然后,复发或DP 然后发现不.然后,他们发现,他们并没有阅 ...
随机推荐
- start apache2 failed in Ubuntu
Invalid command 'WSGIReloadMechanism', perhaps misspelled or defined by a module not included in the ...
- Winform之ListView
ListView表示 Windows 列表视图控件,该控件显示可用四种不同视图之一显示的项集合.
- 31.DDR2问题3_waring?
Warning: (vlog-2275) 'ddr2_controller' already exists and will be overwritte. 出现这个waring,是因为xxx_bb.v ...
- ionic:Build mobile apps faster with the web technologies you know and love
http://ionicframework.com/getting-started/ 5 Ionic Framework App Development Tips and Tricks http:// ...
- DataGridView控件
DataGridView控件 DataGridView是用于Windows Froms 2.0的新网格控件.它可以取代先前版本中DataGrid控件,它易于使用并高度可定制,支持很多我们的用户需要的特 ...
- asp.net 间传值的方法
1.页面间使用post请求时,可以使用Request.Form["xxx"] 2.QueryString 3.Context上下文传值,使用在Server.Transfer中,这个 ...
- 团队开发——SCRUM报告(一)
一.成员介绍 队长:胡亚宝 PM:曹美娜 成员:焦燕.袁亚姣.黄亚萍 二.sprint会议 由于之前是一五一小长假,所以距离上次会议中间隔了很长时间,这里在对上次会议做一下简单的汇总 在上次会议上我们 ...
- 提取html中的src 路径
/// <summary> /// 替换body中的img src属性 附加上域名 /// </summary> /// <param name="str&qu ...
- ubuntu mysql 使用
环境:ubuntu 12.04.5 mysql-server-5.5 安装:sudo apt-get install mysql-server-5.5 (服务端 第一台虚拟机) sudo apt ...
- chm文件右边部分查看不了
右键属性-> 下面好像有句话是说该文件来自网络为保护您的计算机什么什么的,, 然后你解除锁定就能用了 版权声明:本文为博主原创文章,未经博主允许不得转载.