codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

805B.md (1090B)


      1 Source: https://codeforces.com/problemset/problem/805/B
      2 
      3 B. 3-palindrome
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 In the beginning of the new year Keivan decided to reverse his name. He doesn't like palindromes, so he changed Naviek to Navick.
     22 
     23 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.
     24 
     25 Input
     26 
     27 The first line contains single integer *n* (1 ≤ *n* ≤ 2·105) — the length of the string.
     28 
     29 Output
     30 
     31 Print the string that satisfies all the constraints.
     32 
     33 If there are multiple answers, print any of them.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 2
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 aa
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 3
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 bba
     59 ```
     60 
     61 Note
     62 
     63 A palindrome is a sequence of characters which reads the same backward and forward.