5分求助!
查看原帖
5分求助!
1038902
封禁用户楼主2024/3/24 15:32

提交记录: https://www.luogu.com.cn/record/152479095
代码:

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,s,d,f,g,h=INT_MIN,j,k,l;
	cin>>a>>s;
	for(int i=1;i<=a;i++)
	{
		cin>>d;
		f=d%s;
		g=min(f,s-f);
		h=max(h,g);
	}
	cout<<h;
	return 0;
}
2024/3/24 15:32
加载中...