codeforce 604B More Cowbell
题意:n个球,分成k堆。问堆的最大值的最小。
1 #include <bits/stdc++.h> 2 typedef long long ll; 3 using namespace std; 4 int main(){ 5 ll n, m, aa[111111]; 6 scanf("%I64d %I64d", &n, &m); 7 for(ll i = 1 ; i <= n ; i ++) 8 scanf("%I64d", &aa[i]); 9 ll a = m * 2 - n, mx = aa[n]; 10 for(int i = 1 ; i <= n - a ; i ++){ 11 mx = max(mx, aa[i] + aa[n - a - i + 1]); 12 } 13 printf("%I64d", mx); 14 return 0; 15 }