一开始模拟了很多样例。。。对于长度为n的字符串只能找到回文子串个数为n的 所以就猜想除了n 其他都是NO
然后就WA了
后来 暴力了之后发现一个字符串出现的比较频繁 abbaba
后来发现这是一个循环结 整个的字符串的个数是跟这段字符串有关的。。。
我是搬运工
#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <string>
#include <vector>
#include <queue>
#define MEM(a,x) memset(a,x,sizeof a)
#define eps 1e-8
#define MOD 10009
#define MAXN 10010
#define MAXM 100010
#define INF 99999999
#define ll __int64
#define bug cout<<"here"<<endl
#define fread freopen("ceshi.txt","r",stdin)
#define fwrite freopen("out.txt","w",stdout)
using namespace std;
inline int Read()
{
char ch;
int a = 0;
while((ch = getchar()) == ' ' | ch == '\n');
a += ch - '0';
while((ch = getchar()) != ' ' && ch != '\n')
{
a *= 10;
a += ch - '0';
}
return a;
}
inline void Print(int a)
{
if(a>9)
Print(a/10);
putchar(a%10+'0');
}
char ss[] = "abbaba";
int main()
{
//fread;
int n;
while(~scanf("%d", &n))
{
if(n <= 7)
{
for(int i = 1; i < n; i++)
{
Print(i);
puts(" : NO");
}
Print(n);
putchar(' '), putchar(':'), putchar(' ');
for(int i = 1; i <= n; i++) putchar('a');
puts("");
}
else if(n == 8)
{
for(int i = 1; i < 7; i++)
{
Print(i);
puts(" : NO");
}
puts("7 : aabbabaa");
Print(n);
putchar(' '), putchar(':'), putchar(' ');
for(int i = 1; i <= n; i++) putchar('a');
puts("");
}
else
{
for(int i = 1; i <= 7; i++)
{
Print(i);
puts(" : NO");
}
for(int i = 8; i < n; i++)
{
Print(i);
putchar(' '), putchar(':'), putchar(' ');
for(int j = 0; j < i - 8 + 1; j++) putchar('a');
int loop = (n - (i - 8 + 1)) / 6, res = (n - (i - 8 + 1)) % 6;
while(loop--)
{
// printf("abbaba");
putchar('a');
putchar('b');
putchar('b');
putchar('a');
putchar('b');
putchar('a');
}
for(int j = 0; j < res; j++) putchar(ss[j]);
puts("");
}
Print(n);
putchar(' '), putchar(':'), putchar(' ');
// printf("%d : ", n);
for(int i = 1; i <= n; i++) putchar('a');
puts("");
}
}
return 0;
}