hdu 4696 Answers(规律)
2015-11-12 14:38
288 查看
题目链接:hdu 4696 Answers
解题思路
只要存在一个c为1的即所有m大于0的都可以构成,如果不存在c为1,则m为大于0的偶数可以构成代码
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; int main () { int n, m; while (scanf("%d%d", &n, &m) == 2) { int c = 0, x; for (int i = 1; i <= n; i++) scanf("%d", &x); for (int i = 1; i <= n; i++) { scanf("%d", &x); if (x == 1) c = 1; } for (int i = 0; i < m; i++) { scanf("%d", &x); if (x > 0 && (c == 1 || (x % 2 == 0))) printf("YES\n"); else printf("NO\n"); } } return 0; }
相关文章推荐
- RAC添加节点遇到的错误
- Bluemix 动手系列 (二) 通过命令行部署和更新云应用
- linux如何安装jdk
- svn status 返回值详解
- chrome,IE上传图片,js获取图片绝对路径的方法
- 为自己打造Linux小系统
- json字符串和json对象相互转化
- 原型链
- 谈谈Tempdb对SQL Server性能优化有何影响
- OkHttp使用教程
- 解决pybrain的No module named 'structure' 问题
- 问题记录:在打包APK的时候遇到的问题
- Xcode 中的View调试
- android 遗忘很久的android 渐变色
- URL中的汉字和特殊字符编码,以及ASIHTTPRequest对此的处理
- 泛型的一些知识(网上找的)
- Mac下android_sdk配置环境变量
- Ajax+ashx+json三层架构无刷新分页、删除、修改、查看
- textarea ie不支持maxLength属性
- 混合运算改进(代码)