POJ 1837(Dp水题)
来源:互联网 发布:c语言编程判断素数 编辑:程序博客网 时间:2024/06/06 23:18
这题居然不用高精度就能过……测试数据好弱
Program P1837;var c,g,i,j,k,p:longint; li,w:array[1..20] of longint; f:array[1..20,-7500..7500] of longint;begin fillchar(f,sizeof(f),0); read(c,g); for i:=1 to c do read(li[i]); for i:=1 to g do read(w[i]); for i:=1 to c do f[1,li[i]*w[1]]:=1; for i:=2 to g do for j:=1 to c do begin p:=li[j]*w[i]; if p<0 then begin for k:=-7500 to 7500+p do if f[i-1,k-p]>0 then inc(f[i,k],f[i-1,k-p]) end else begin for k:=-7500+p to 7500 do if f[i-1,k-p]>0 then inc(f[i,k],f[i-1,k-p]); end; end; writeln(f[g,0]);end.
- POJ 1837(Dp水题)
- POJ 1837 Balance(DP)
- POJ 1837 - Balance (dp)
- poj - 1837 - Balance(dp)
- POJ 1837 Balance(DP)
- POJ 1837 balance(dp)
- POJ 1837 Balance(DP)
- poj 1837 Balance(DP)
- POJ 1837 Balance(dp)
- poj 1837 Balance (dp 01背包)
- poj 1837 Balance (dp,01背包)
- POJ 1837 Balance (简单DP)
- 文章标题 poj 1837: Balance(dp)
- POJ 1837 Balance (DP-01背包)
- POJ 1837 Balance DP
- POJ 1837 dp
- POJ--1837--Balance--DP
- POJ 1837 Balance (DP)
- 在 Windows XP 的 Apache 2.2.9 环境下安装 TWiki 4.2.2
- UIlable UITextField的用法
- asp.net 弹出层编辑
- zoj 3630(tajan)求强连通分量的个数
- new、override、virtual用法区别
- POJ 1837(Dp水题)
- IE6下背景图片透明解决
- 关于 LIBGHTTP 收集的资料
- 我要学ASP.NET MVC 3.0(八): MVC 3.0 传递和保存你的Model
- Hive限制
- 如何让Android UI使用更快更高效
- vs2008打包程序需要.net3.5支持问题的解决方案
- 酒的真正内涵
- 如何编写高效的 Android 代码