zoukankan      html  css  js  c++  java
  • codeforces689A

    div2A

    用四个二进制位记每个点状态,O(n)判断一下即可

    #include <bits/stdc++.h>
    using namespace std;
    typedef int ll;
    inline ll read()
    {
        ll s=0; bool f=0; char ch=' ';
        while(!isdigit(ch)) {f|=(ch=='-'); ch=getchar();}
        while(isdigit(ch)) {s=(s<<3)+(s<<1)+(ch^48); ch=getchar();}
        return (f)?(-s):(s);
    }
    #define R(x) x=read()
    inline void write(ll x)
    {
        if(x<0) {putchar('-'); x=-x;}
        if(x<10) {putchar(x+'0'); return;}
        write(x/10); putchar((x%10)+'0');
    }
    #define W(x) write(x),putchar(' ')
    #define Wl(x) write(x),putchar('
    ')
    const int N=10;
    int n,b[N];
    int main()
    {
        freopen("codeforces.in","r",stdin);
        int i,wwx=15;
        char ch=' ';
        R(n);
        b[0]=1;
        b[1]=6;
        b[2]=14;
        b[3]=12;
        b[4]=7;
        b[5]=15;
        b[6]=13;
        b[7]=3;
        b[8]=15;
        b[9]=9;
        for(i=1;i<=n;i++)
        {
            while(!isdigit(ch)) ch=getchar();
            wwx&=b[(int)ch-'0'];
            ch=' ';
        }
        wwx?puts("NO"):puts("YES");
        return 0;
    }
    View Code
    河田は河田、赤木は赤木……。 私は誰ですか。教えてください、私は誰ですか。 そうだ、俺はあきらめない男、三井寿だ!
  • 相关阅读:
    计算机书籍.网址
    MVC是必知必用的
    技术
    三色旗帜分类
    巴斯卡三角形
    Centos安装wine等组件的问题
    some software that is used to speed up your system
    驾照考试系统之流程图
    用静态成员函数调用非静态成员变量
    MFC 进度条控件
  • 原文地址:https://www.cnblogs.com/gaojunonly1/p/15442924.html
Copyright © 2011-2022 走看看