1 条题解

  • 0
    @ 2025-11-15 21:15:34
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    const int N=1e6+5;
    const ll inf=1e18;
    ll t,n,x;
    ll a[N];
    int main(){
    	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    	cin>>t;
    	while(t--){
    		ll mx=0,sum=0;
    		cin>>n>>x;
    		for(int i=1;i<=n;i++){
    			cin>>a[i];
    			sum+=a[i];
    			mx=max(mx,a[i]);
    		}
    		cout<<max(mx,(sum+x-1)/x)<<'\n';
    		//(sum+x-1)/x的操作类似于向上取整,跟ceil函数作用一样
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    1196
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    (无)
    递交数
    24
    已通过
    4
    上传者