20分求大佬调调
  • 板块学术版
  • 楼主封禁用户
  • 当前回复2
  • 已保存回复2
  • 发布时间2024/8/17 15:14
  • 上次更新2024/8/17 17:58:20
查看原帖
20分求大佬调调
1418850
封禁用户楼主2024/8/17 15:14
#include<bits/stdc++.h>
using namespace std;
int n,l,ans=0,tot=0;
int main()
{
	cin>>l>>n;
	for(int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		ans=max(min(l-a,a),ans);
		tot=max(max(l-a,a),tot);
	}
	cout<<ans<<" "<<tot;
}

p1007独木桥

2024/8/17 15:14
加载中...