rt
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const long long MAX=1e10;
ll a[MAX],n,m;
bool up(int h){
ll num=0;
for (int i = 1; i <=n ; ++i) {
if(h<a[i]){
num+=a[i]-h;
}
}
if(num>=m){
return true;
}else{
return false;
}
}
int main(){
ios::sync_with_stdio(false);
cin>>n>>m;
for (int i = 1; i <=n ; ++i) {
cin>>a[i];
}
int l=0,r=1e9,ans,middle;
while (l<=r){
middle=(l+r)>>1;
if(up(middle)){
ans=middle;
l=middle+1;
}else{
r=middle-1;
}
}
cout<<ans<<endl;
return 0;
}
No valid executable file was produced by the compiler
./ccKBBl5h.o: in function `__static_initialization_and_destruction_0(int, int)':
src:(.text+0x1a3): relocation truncated to fit: R_X86_64_PC32 against `.bss'
src:(.text+0x1bc): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: 错误:ld 返回 1
谢谢您