C. Good String

Правка en1, от willtryagain, 2020-08-02 15:28:45

In the problem good string([https://mirror.codeforces.com/problemset/problem/1389/C]) I made two observations- i. When n is odd then all characters are equal ii. Else s1 = s3 = ... = sn s2 = s4 = ... = sn-1

It means the string is fixed by the first two starting characters. I iterated from 0 to 9 for the first two characters and found the count of positions- if i is odd and si != s1 or i is even and si != s2

My answer is off by one in some test cases. I want to a small test string where I could find the reason.

Теги #greedy

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский willtryagain 2020-08-02 15:32:27 85 Tiny change: '!= s1 or\n- i i' -> '!= s1 or\n~~~~~\n\n- i i'
en1 Английский willtryagain 2020-08-02 15:28:45 555 Initial revision (published)