P2931 [USACO09HOL] Pearl Bracelet G【征集 SPJ】
Description
Bessie received a magic bracelet of a set of the rarest black pearls for her favorite holiday. Bessie loved the bracelet and marveled that each pearl contained a small number engraved on it. She noticed that if you align the the bracelet's pearls in all the possible ways by bending it around some point (see below), the 'progressive' sums of the pearls' numbers that have corresponding numbers on the top and bottom sides of the bracelet never, everatch when compared using mod M (2
Input Format
\* Line 1: Two space-separated integers: the case number and M
Output Format
\* Line 1: A single line containing the task name and case number: #FILE perlbrac CASENUM
\* Line 2: A single line with a single integer, N (which must be no larger than 20,000)
\* Lines 3..N+1: Line i+2 contains a single integer that is the integer etched onto the i-th pearl on the bracelet; this number should be between 0 and M - 1, inclusive