zoukankan      html  css  js  c++  java
  • 洛谷 P1580 yyy loves Easter_Egg I

                 洛谷 P1580 yyy loves Easter_Egg I

    题解:

    队列+字符串

    #include <cstdio>
    #include <string>
    #include <cstring>
    #include <iostream>
    #include <algorithm>
    using namespace std;
    const int MAXN=200;
    int cur=1;
    char a[MAXN],b[MAXN],n1[MAXN],n2[MAXN];
    int main() {
        gets(a);
        sscanf(strstr(a,"@"),"@yyy loves %s",b);
        while(++cur) {
            gets(a);
            if(strlen(a)==1) break;
            sscanf(a,"yyy loves %s",n1);
            if(!strcmp(n1,b))
                return printf("Successful @yyy loves %s attempt",b),0;
            if(strstr(a,"@")!=NULL) sscanf(strstr(a,"@"),"@yyy loves %s",n2);
            if(count(a,a+strlen(a),'@')!=1||strcmp(n2,b)) {
                printf("Unsuccessful @yyy loves %s attempt
    ",b);
                printf("%d
    yyy loves %s",cur,n1);
                return 0;
            }
        }
        printf("Unsuccessful @yyy loves %s attempt
    ",b);
        printf("%d
    Good Queue Shape",cur-1);
        return 0;
    } 

    一世安宁

  • 相关阅读:
    泛型
    事件和委托
    参数和属性
    常量、字段、和方法
    LINQ
    LINQ- 子查询、组合策略、投影策略
    MySQL全局锁和表锁
    CLR基础
    LINQ
    LINQ
  • 原文地址:https://www.cnblogs.com/GTBA/p/9440605.html
Copyright © 2011-2022 走看看