hdu 1028 Ignatius and the Princess III
来源:互联网 发布:小米生态链是什么 知乎 编辑:程序博客网 时间:2024/06/05 10:00
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1028
思路一:和hdu1398 1284一样
思路二:参考自http://www.cnblogs.com/xingluzhe/archive/2009/09/01/1557844.html
code1
#include<cstdio>#include<iostream>#include<cmath>#include<cstring>using namespace std;int main(){ int dp[122]; int n,i,j; memset(dp,0,sizeof(dp)); dp[0]=1; for(i=1;i<=122;i++) { for(j=i;j<=122;j++) { dp[j]+=dp[j-i]; } } while(scanf("%d",&n)==1) { printf("%d\n",dp[n]); } return 0;}
code 2:
#include<cstdio>#include<iostream>typedef __int64 ll;using namespace std;ll dp[125][125];int main(){ ll n,i,j; while(scanf("%d",&n)==1) { for(i=0;i<122;i++) { dp[i][1]=1; dp[1][i]=1; } for(i=2;i<122;i++) { for(j=2;j<122;j++) { if(j>i) dp[i][j]=dp[i][i]; if(j==i) dp[i][j]=dp[i][j-1]+1; if(j<i) dp[i][j]=dp[i][j-1]+dp[i-j][j]; } } printf("%I64d\n",dp[n][n]); } return 0;}
0 0
- hdu 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- HDU-1028-Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- hdu 1028 Ignatius and the Princess III
- HDU--1028 Ignatius and the Princess III
- HDU 1028 Ignatius and the Princess III
- Ignatius and the Princess III hdu 1028
- android最新环境搭建的问题!
- 无法访问google的简单解决办法
- 超级详细01背包
- Raft一致性算法
- MFC对键盘消息的截取与响应
- hdu 1028 Ignatius and the Princess III
- JAVA对Excel的操作小例子一则
- Java面试题
- Ubuntu系统中安装修改JAVA环境变量
- 七年IT生涯,就这么的废了
- 监测和管理Xcache状态
- poj 1088 滑雪(DP+记忆化dfs)
- 网络最大流之dinic模板
- 【STL】POJ 2418---Hardwood Species