洛谷 P1580 yyy loves Easter_Egg I

时间:2022-08-07 20:56:26

             洛谷 P1580 yyy loves Easter_Egg I

洛谷 P1580 yyy loves Easter_Egg I

洛谷 P1580 yyy loves Easter_Egg I

洛谷 P1580 yyy loves Easter_Egg I

洛谷 P1580 yyy loves Easter_Egg I

洛谷 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=;
int cur=;
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)==) break;
sscanf(a,"yyy loves %s",n1);
if(!strcmp(n1,b))
return printf("Successful @yyy loves %s attempt",b),;
if(strstr(a,"@")!=NULL) sscanf(strstr(a,"@"),"@yyy loves %s",n2);
if(count(a,a+strlen(a),'@')!=||strcmp(n2,b)) {
printf("Unsuccessful @yyy loves %s attempt\n",b);
printf("%d\nyyy loves %s",cur,n1);
return ;
}
}
printf("Unsuccessful @yyy loves %s attempt\n",b);
printf("%d\nGood Queue Shape",cur-);
return ;
}

一世安宁