[CF805B] 3-palindrome(构造)

题目链接:http://codeforces.com/contest/805/problem/B

题意:给三个字符abc,希望用尽量少的c,构造不含有长度为3的回文串的字符串。

不含有不是超过,读错题卡了一小会。构造aabb输出就行了。

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 
 4 typedef long long LL;
 5 const LL mod = (LL)1e9+7;
 6 const int maxn = 1001000;
 7 char s[maxn];
 8 int n;
 9 
10 int main() {
11     // freopen("in", "r", stdin);
12     while(~scanf("%d", &n)) {
13         const char* q = "aabb";
14         for(int i = 0; i < n; i++) printf("%c", q[i%4]);
15         printf("\n");
16     }
17     return 0;
18 }

 

posted @ 2017-05-15 16:22  Kirai  阅读(118)  评论(0编辑  收藏  举报