AtCoder:Colorful Balls(思维 & 数论)
D - Colorful BallsTime limit : 2sec / Memory limit : 256MBScore : 1000 pointsProblem StatementSnuke arranged N colorful balls in a row. The i-th ball from the left has color ci a