codefoeces 411 div 2 -3-palindrome
来源:互联网 发布:windows无法安装usb 编辑:程序博客网 时间:2024/06/03 14:03
B. 3-palindrome
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substring. For example, the strings "abc" and "abca" suit him, while the string "aba" doesn't. He also want the number of letters 'c' in his string to be as little as possible.
Input
The first line contains single integer n (1 ≤ n ≤ 2·105) — the length of the string.
Output
Print the string that satisfies all the constraints.
If there are multiple answers, print any of them.
Examples
Input
2
Output
aa
Input
3
Output
bba
Note
time limit per test1 second
memory limit per test256 megabytes
inputstandard input
outputstandard output
In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
He is too selfish, so for a given n he wants to obtain a string of n characters, each of which is either 'a', 'b' or 'c', with no palindromes of length 3 appearing in the string as a substring. For example, the strings "abc" and "abca" suit him, while the string "aba" doesn't. He also want the number of letters 'c' in his string to be as little as possible.
Input
The first line contains single integer n (1 ≤ n ≤ 2·105) — the length of the string.
Output
Print the string that satisfies all the constraints.
If there are multiple answers, print any of them.
Examples
Input
2
Output
aa
Input
3
Output
bba
Note
A palindrome is a sequence of characters which reads the same backward and forward.
#include<cstdio>#include<iostream>using namespace std;int main() {int n;cin >> n;for (int i = 0; i < n; i++) {if (i % 4 == 0 || i % 4 == 1) cout << 'a';else cout << 'b';}printf("\n");}
阅读全文
0 0
- codefoeces 411 div 2 -3-palindrome
- Codeforces Round #411 (Div. 2) B. 3-palindrome
- Codeforces Round #411 (Div. 2) B. 3-palindrome(思维题)
- Codefoeces 2B. The least round way
- Codefoeces 3A. Shortest path of the king
- Codeforces Round #277 (Div. 2)C——Palindrome Transformation
- Codeforces Round #277 (Div. 2)---C. Palindrome Transformation (贪心)
- Codeforces 311(div 2):E. Ann and Half-Palindrome
- Codeforces Round #277 (Div. 2) C. Palindrome Transformations 贪心
- Codeforces Round #389 (Div. 2):Santa Claus and a Palindrome
- Codeforces Round #410 (Div. 2)-A. Mike and palindrome-思维
- Codeforces Round #410 (Div.2) A.Mike and palindrome-模拟
- codefoeces 567 D
- codefoeces 414A (构造)
- Codefoeces dp练习题
- codefoeces C.Buggy Sorting
- codefoeces 755B
- codefoeces 115A Party
- Shell脚本基础知识
- 函数
- spring注解
- java CMS垃圾回收日志解释
- Sourcegraph插件安装及介绍
- codefoeces 411 div 2 -3-palindrome
- andorid6.0 mtk6737平台 ctp调试方法
- CSDN爬虫(三)——网络爬虫模拟登陆两种策略
- Java集合:ArrayList的实现原理
- Chrome浏览器添加Proxy Switchy插件
- APUE-输入和输出
- 如何安装把包安装到ios手机上
- 正则表达式应用的举例
- 10/21 ip 网关 以及设置网关