就像1、2元人民币可以凑成任意你想要的面值一样。由于一定会有环,只要有C[i] == 1 就可以造成任何数。够坑吧

#include <cstdio>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std; const int maxe = ;
const int maxn = 1e5+;
const int INF = 0x3f3f3f; int main()
{
int C[maxn],T[maxn];
int N,Q; while(cin>>N>>Q){
bool flag = false;
for(int i=;i<=N;i++) scanf("%d",&T[i]);
for(int i=;i<=N;i++) {scanf("%d",&C[i]); if(C[i] == ) flag = true; } int M;
for(int i=;i<=Q;i++){
scanf("%d",&M);
if(M <= ) printf("NO\n");
else{
if(flag) printf("YES\n");
else{
if(M%) printf("NO\n");
else printf("YES\n");
}
}
}
} }

hdu4696 想法题的更多相关文章

  1. HDU 4972 Bisharp and Charizard 想法题

    Bisharp and Charizard Time Limit: 1 Sec  Memory Limit: 256 MB Description Dragon is watching NBA. He ...

  2. CodeForces 111B - Petya and Divisors 统计..想法题

    找每个数的约数(暴力就够了...1~x^0.5)....看这约数的倍数最后是哪个数...若距离大于了y..统计++...然后将这个约数的最后倍数赋值为当前位置...好叼的想法题.... Program ...

  3. HDU - 5806 NanoApe Loves Sequence Ⅱ 想法题

    http://acm.hdu.edu.cn/showproblem.php?pid=5806 题意:给你一个n元素序列,求第k大的数大于等于m的子序列的个数. 题解:题目要求很奇怪,很多头绪但写不出, ...

  4. HDU - 5969 最大的位或 想法题

    http://acm.hdu.edu.cn/showproblem.php?pid=5969 (合肥)区域赛签到题...orz 题意:给你l,r,求x|y的max,x,y满足l<=x<=y ...

  5. HDU 4193 Non-negative Partial Sums(想法题,单调队列)

    HDU 4193 题意:给n个数字组成的序列(n <= 10^6).求该序列的循环同构序列中,有多少个序列的随意前i项和均大于或等于0. 思路: 这题看到数据规模认为仅仅能用最多O(nlogn) ...

  6. CodeForces - 156B Suspects 逻辑 线性 想法 题

    题意:有1~N,n(1e5)个嫌疑人,有m个人说真话,每个人的陈述都形如X是凶手,或X不是凶手.现在给出n,m及n个陈述(以+x/-X表示)要求输出每个人说的话是true ,false or notd ...

  7. 2016华中农业大学预赛 E 想法题

    Problem E: Balance Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 205  Solved: 64[Submit][Status][We ...

  8. codeforces 657C - Bear and Contribution [想法题]

    题目链接: http://codeforces.com/problemset/problem/657/C ----------------------------------------------- ...

  9. POJ 1066 Treasure Hunt [想法题]

    题目链接: http://poj.org/problem?id=1066 --------------------------------------------------------------- ...

随机推荐

  1. 让ie6/7/8兼容css3的圆角阴影等特殊效果的方法 PIE1.0.0及placeholder在这些IE下生效的方法

    PIE地址:http://css3pie.com/ 使用方法1: #login,#AnnouncementBox {  border:3px solid #fff;  -webkit-border-r ...

  2. P2P

    https://www.ppmoney.com/Withdraw http://www.daibang.com/

  3. power desinger 学习笔记<八>

    转-PowerDesigner 把Comment复制到name中和把name复制到Comment 在使用PowerDesigner对数据库进行概念模型和物理模型设计时,一般在NAME或Comment中 ...

  4. For Me ...

    一直有做博客的打算,但是这也看不上,那也看不上. 总想着做一个personal blog,界面,风格全由自己设计. 可时间上总是不充裕的. 可技术上总是欠火候的. 可内容上总是待斟酌的. 于是时间被我 ...

  5. 设置css三种方法的优先级

    有的小伙伴问了,如果有一种情况:对于同一个元素我们同时用了三种方法设置css样式,那么哪种方法真正有效呢?在下面代码中就出现了这种情况 1.使用内联式CSS设置“超酷的互联网”文字为粉色. 2.然后使 ...

  6. 使用OC开发phonegp 组件

    使用OC开发phonegp 组件 1. 使用oc 对phonegp中的组件近些开发,首先具体的pgonegp跟nativecode之间的一些优劣就不说了,开发phonegp 对应的组件主要就是使用na ...

  7. css media

    /* media */ /* 横屏 */ @media screen and (orientation:landscape){ } /* 竖屏 */ @media screen and (orient ...

  8. apache-php安装mysql简单方法

    1.启用mysql功能,在php.ini中 extension=php_mysql.dll extension=php_mysqli.dll 2. 修改extension_dir = "ex ...

  9. YII 创建后台模块

    1,在protected/config/main.php目录下修改如下目录 'modules'=>array( // uncomment the following to enable the ...

  10. Linux 使用yum install安装mysql登陆不上解决办法

    CentOS yum安装mysql后 Can’t connect to local MySQL server through socket ‘/var/lib/ CentOS Can’t connec ...