Time limit
1000 ms
Memory limit
262144 kB
Source
Codeforces Round #285 (Div. 1)
Tags
implementation math *2500
Editorial
Announcement Tutorial #1 (ru) Tutorial #2 (en)
Descriptions:

Misha and Palindrome Degree

CodeForces - 504C