Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
80665 sh25_zhuwy 接水问题 C++ 通过 7 MS 300 KB 333 2026-01-04 15:26:31

Tests(10/10):


#include<bits/stdc++.h> using namespace std; long long n,m; int a[10010]; bool cmp(int x,int y){ return x>y; } int main(){ scanf("%I64d%I64d",&n,&m); for(int i=1;i<=n;i++) scanf("%d",&a[i]); for(int i=m+1;i<=n;i++){ sort(a+1,a+1+m); a[1]=a[1]+a[i]; } sort(a+1,a+1+m,cmp); cout<<a[1]<<endl; return 0; }


测评信息: