Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2011 Accepted Submission(s): 576
Pog and Szh are playing games.There is a sequence with n numbers,
Pog will choose a number A from the sequence. Szh will choose an another number named B from the rest in the sequence. Then the score will be (A+B) mod p.They
hope to get the largest score.And what is the largest score?
Several groups of data (no more than 5 groups,n≥1000).
For each case:
The following line contains two integers,n(2≤n≤100000)，p(1≤p≤231−1)。
The following line contains n integers ai(0≤ai≤231−1)。
For each case,output an integer means the largest score.
1 2 3 0
0 0 2 2
简单说一下本题题意：给你两个数 n，p，然后在给你 n 个数，让你在其中找到两个数 a ，b，使得（a+b）%p 达到最大
这是杭电BC上面的一道题，有个公式是(a+b)modc==(a mod c+b mod c ) mod c