poj 1837
来源:互联网 发布:淘宝主图如何吸引人 编辑:程序博客网 时间:2024/06/11 07:54
http://poj.org/problem?id=1837
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
using namespace std;
int dp[21][15001];
int main()
{
int n,m;
int c[50];
int g[50];
int i,k,j;
while(scanf("%d%d",&n,&m)!=EOF)
{
for(i=1;i<=n;i++)
scanf("%d",&c[i]);
for(j=1;j<=m;j++)
scanf("%d",&g[j]);
memset(dp,0,sizeof(dp));
dp[0][7500]=1;
for(i=1;i<=m;i++)
for(k=0;k<=15000;k++)
{
if(dp[i-1][k])
for(j=1;j<=n;j++)
dp[i][k+g[i]*c[j]]+=dp[i-1][k];
}
printf("%d\n",dp[m][7500]);
}
return 0;
}
- POJ 1837
- POJ 1837
- poj 1837
- poj 1837
- POJ 1837
- poj 1837
- POJ 1837
- poj.1837
- poj 1837
- poj-1837
- poj 1837
- POJ 1837
- POJ 1837
- poj 1837
- poj 1837
- POJ 1837
- poj-1837
- POJ 1837
- 【OJ】 Clone Graph无向图赋值问题
- linux移植yaffs2文件时候遇到的busybox的问题,以及烧写yaffs2文件时候的问题及解决
- C++ Primer第三章课后编程题
- 【C语言学习】C语言运算符
- eclipse中导入安卓项目时出现莫名其妙的红叉的解决方法
- poj 1837
- 超级rtmp服务器和屌丝wowza
- 计算机书籍整理
- 控制台出现中文乱码
- aes加密算法
- Linux权限问题
- Qt程序在其他电脑上运行时提示:couldnot find or add the Qt platform plugin:windows
- 通过代码查找调用类的位置
- Android--四大组件(题外话)Intent