当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5265:pog loves szh II

题目描述
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 \geq 1000$).

For each case:

The following line contains two integers,$n(2 \leq n \leq 100000)$,$p(1 \leq p \leq 2^{31}-1)$。

The following line contains $n$ integers $a_i(0 \leq a_i \leq 2^{31}-1)$。
输出解释
For each case,output an integer means the largest score.
输入样例
4 4
1 2 3 0
4 4
0 0 2 2
输出样例
3
2
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #43

源链接: HDU-5265

最后修改于 2020-10-25T23:21:10+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 65536/65536K(Java/Others)