传送门:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=114353#problem/F
第一次pc^2练习赛,队内大腿回家,没有比赛……比的艰辛无比。
题意:每4句诗构成一组,分为4种韵律,aabb,aaaa,abab,abba。一首长诗如果每组都是一种韵律,那么整首诗的韵律就是这种,如果是由aaaa和其他韵律构成的,那么就是那种韵律,如果是由除了aaaa这种之外的两种或以上构成的,就输出NO。
分析:最开始没太读懂题意,后来按照自己的理解试着敲一发,运气1A。这题就是把每组输入从后向前进行处理,处理到第k个元音,如果字符中元音大于k,则输出肯定为no,之后基本就是模拟比较的过程,容易错的地方主要是一共有几个需要特判,也就是需要标记最后统一输出no的,具体的代码中有。
代码:
/* *********************************************** Author :Torrance_ZHANG Created Time :2016/4/30 20:50:27 File Name :ceshi.cpp ************************************************ */ #include <stdio.h> #include <string.h> #include <iostream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <string> #include <math.h> #include <stdlib.h> #include <time.h> typedef long long int LL; using namespace std; char s[100010],ss[5][100010]; int tmp[10]; int main(){ int n,k,l; while(~scanf("%d%d",&n,&k)){ bool flag=true; memset(tmp,0,sizeof(tmp)); for(int i=1; i<=n; i++){ memset(ss,'