Contest 2016-5-7 B(HDU 5616)
来源:互联网 发布:泰国 试管婴儿 知乎 编辑:程序博客网 时间:2024/04/27 10:10
#include<cstdio>#include<cstring>#include<cmath>const int MAXN=2005;int w[MAXN];bool dp[MAXN];int main(){ int i,j,t,n,q,k; scanf("%d",&t); while(t--){ scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&w[i]); memset(dp,false,sizeof(dp)); dp[0]=true; for(i=0;i<n;i++){ for(int j = MAXN;j>=w[i];j--) dp[j]|=dp[j-w[i]]; } for(i=0;i<n;i++) for(j=0;j<=MAXN-w[i];j++) dp[j]|=dp[j+w[i]]; scanf("%d",&q); for(i=1;i<=q;i++){ scanf("%d",&k); if(dp[k]) printf("YES\n"); else printf("NO\n"); } } return 0;}
1 0
- Contest 2016-5-7 B(HDU 5616)
- Contest 2016-5-7 A(HDU 5615)
- Contest 2016-5-7 C(HDU 5617)
- SDKD 2016 Summer Single Contest #01.B
- SDKD 2016 Summer Single Contest #02.B
- SDKD 2016 Summer Single Contest #03.B
- SDKD 2016 Summer Single Contest #12 .B
- SDKD 2016 Summer Single Contest #13 .B
- http://codeforces.com/contest/7/problem/B
- hdu 5818 2016 Multi-University Training Contest 7(模拟)
- hdu 5791 2016 Multi-University Training Contest 5(dp)
- HDU 5785 Interesting 2016 Multi-University Training Contest 5(Manacher)
- B. Valera and Contest
- B - Qualifying Contest
- Codeforces 656 B. Scrambled(April Fools Day Contest 2016)
- HDU 57242016多校Contest 1 B题【SG函数,题目input比较猥琐】
- 【CUGBACM15级BC第33场 B】hdu 5187 zhx's contest
- 5月2 JAG2014 Practice Contest B题 Unknown Switches
- 插入排序法
- 机器学习课堂笔记(十五)
- 小さな手のひら
- HDU 4586Play the Dice 概率dp+等比数列 级数
- Zimbre RROR: Installation can not proceeed. Please fix your /etc/hosts file 报错解决方法
- Contest 2016-5-7 B(HDU 5616)
- jQuery操作DOM节点的相关方法
- 言叶にできない
- RecycleView(插件式架构)使用
- 结构体的偏移量计算
- 手机分辨率
- 多线程编程
- 一个帖子学会Android开发四大组件
- LeetCode Swap Nodes in Pairs