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 !!
# | User | Rating |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | nor | 152 |
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 !!
Name |
---|
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