zoukankan      html  css  js  c++  java
  • codeforce 906 SOL (A)

    一道英语阅读理解,满满的都是套路,欺负我英文不好(自己去翻译吧,我就不写中文了)

    我们模拟一遍就好了,如果"!"把句子中没出现的字母排除,"."就排除句子里出现的。
    注意答案是从已知那个字母开始统计的。
    #include<bits/stdc++.h>
    using namespace std;
    int n,len,p[28],ot[28],ed,ans,top;
    char ch[37],s[100007];
    int main () {
        freopen("a.in","r",stdin);
        scanf("%d
    ",&n);n--;
        while (n--) {
            scanf("%s",ch); scanf("%s",s); len=strlen(s);
            switch (ch[0]) {
                case '.':
                    for (int i=0;i<len;i++) p[s[i]-'a']=1;
                    break;
                case '?': 
                    if (ed) {ans++; break;}
                    p[s[0]-'a']=1; break;
                case '!':
                    if (ed) {ans++; break;}
                    memset(ot,0,sizeof ot);
                    for (int i=0;i<len;i++)
                     ot[s[i]-'a']=1;
                    for (int i=0;i<26;i++)
                     if (!ot[i]) p[i]=1;
            }
            if (!ed) {
            top=0;
            for (int i=0;i<26;i++)
             if (!p[i]) top++;
            if (top==1) ed=1; }
        }
        printf("%d
    ",ans);
    }
  • 相关阅读:
    php遍历目录下的所有文件夹
    PHP 遍历文件
    PHP中public protected private的区别
    mysql数据库优化的方法
    Thinkphp 验证器
    PHP 接口
    php获取表单的值
    PHP 数组
    php 递归
    [go系列] 函数
  • 原文地址:https://www.cnblogs.com/rrsb/p/8298322.html
Copyright © 2011-2022 走看看