zoukankan      html  css  js  c++  java
  • hdu4696 想法题

     就像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 = 50000;
    const int maxn = 1e5+5;
    const int INF  = 0x3f3f3f;
    
    int main()
    {
        int C[maxn],T[maxn];
        int N,Q;
    
        while(cin>>N>>Q){
            bool flag = false;
            for(int i=1;i<=N;i++)  scanf("%d",&T[i]);
            for(int i=1;i<=N;i++)  {scanf("%d",&C[i]); if(C[i] == 1) flag = true;  }
    
            int M;
            for(int i=1;i<=Q;i++){
                scanf("%d",&M);
                if(M <= 0)  printf("NO
    ");
                else{
                    if(flag)   printf("YES
    ");
                    else{
                        if(M%2) printf("NO
    ");
                        else    printf("YES
    ");
                    }
                }
            }
        }
    
    }
    View Code
  • 相关阅读:
    xml
    反射
    类加载器
    TCP通信
    UDP通信
    网络通信
    【SpringBoot】Freemarkerの主キー
    【SpringBoot】Warの作成
    【Excel】ファイルの拡張子
    【SAP】TCODE表
  • 原文地址:https://www.cnblogs.com/acmdeweilai/p/3275811.html
Copyright © 2011-2022 走看看