一个题案例过不了,结果是因为,cout输出科学计数法了。
那么这样写就好了
#include<bits/stdc++.h>
#define N 105
#define endl '\n'
#define _for(i,a,b) for(int i=a;i<b;i++)
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n,len; int res = 0;
cin>>n>>len;
vector<int> a(n);
for( int & i : a) cin>>i;
sort(a.begin(),a.end());
_for(i,0,n-1){
if( a[i]==a[i+1] ) continue;
res = max(res,abs(a[i+1]-a[i]) ) ;
}
res = max( res,2*a[0] );
res = max( res,2*(len-a[n-1]) );
cout<<fixed<< setprecision(9) << res/2.0 <<endl;
return 0;
}