UVA 10912 Simple Minded Hashing
来源:互联网 发布:数据库 防黑客 编辑:程序博客网 时间:2024/06/14 23:35
题意:求长度为L状态为S的方法有多少,用三维表示前i个字符组成长度为j的状态是S的个数有多少,看了题解才知道用三维的,开始想到的是二维的,功力不够啊,想到的话就不会难了,
#include <iostream>#include <cstdio>#include <cstring>using namespace std;int f[27][27][355];int main(){ memset(f,0,sizeof(f)); f[0][0][0] = 1; int sum = 355; for (int i = 1; i <= 26; i++) for (int j = 0; j <= i; j++) for (int k = 0; k <= 351; k++){ f[i][j][k] = f[i-1][j][k]; if (j && k >= i) f[i][j][k] += f[i-1][j-1][k-i]; } int cas = 1,l,s; while (scanf("%d%d",&l,&s) != EOF && l+s){ int ans = (l>26||l<1||s>351||s<1)?0:f[26][l][s]; printf("Case %d: %d\n",cas++,ans); } return 0;}
- UVA 10912 Simple Minded Hashing
- UVA 10912 Simple Minded Hashing
- UVa:10912 Simple Minded Hashing
- uva 10912 - Simple Minded Hashing(计数)
- uva 10912 Simple Minded Hashing (DP)
- Uva 10912 Simple Minded Hashing (计数DP)
- 10912 - Simple Minded Hashing
- 10912 - Simple Minded Hashing (dp)
- UVA10912 - Simple Minded Hashing(dp)
- UVa 10014 - Simple calculations
- uva 10014 - Simple calculations
- uva 10014 Simple calculations
- uva 10014 - Simple calculations
- Uva 10014 - Simple calculations
- UVa 10994 - Simple Addition
- UVa 10014 - Simple calculations
- UVA 10994 Simple Addition
- UVA 10014 Simple calculations
- mybatis association的使用
- linux和windows共享文件夹的互相访问
- CSF 中的应用程序请求路由
- 计算s=1-1/2^1+1/2^2-…+1/2^8
- C# 打印Label
- UVA 10912 Simple Minded Hashing
- 书评:使用Android SDK构建应用,第2版
- Quartz 2D编程指南(3) - 路径(Paths)【上】
- 设计模式——策略模式(Strategy)
- ros中的一些传感器
- map容器
- Android百度地图 - 路径规划(驾车、步行和公交线路搜索)
- JS的Document属性和常用方法
- Problem 2088 最长队名 字典序,qsort考察