Plz help me in solving a simple problem on spoj http://www.spoj.pl/problems/MAIN113/
i am not able to conclude a general formula for any 'n'........i derived one but found it wrong...plz some one guide !!
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Plz help me in solving a simple problem on spoj http://www.spoj.pl/problems/MAIN113/
i am not able to conclude a general formula for any 'n'........i derived one but found it wrong...plz some one guide !!
Название |
---|
The total number of string that are speacial will always be 6 ?? since the number of ways to select 1st character are 3 and for 2nd 2 and 3rd 1 and once we select a letter then the letter on i+3th position should be the same as ith letter.so what I'm doing is, calculating the number of total strings of length n made using X,Y,Z ,. 3^n and substracting it from 6.But i'm getting wrong answer.Here is the code http://ideone.com/UuTLaj .Pls tell me where I'm wrong in this approach.
No, is not always 6.
Why i+3th position should be the same as ith letter? YZXXYY is special