题目描述
C++ 代码
#include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <string.h>
#include <cstring>
#include <queue>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <stdlib.h>
#include <math.h>
using namespace std;
int n,m,ma,mi,x,a[110];
int main() {
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>x;
mi=1;
for(int j=2;j<=m;j++){
if(a[j]<a[mi]){
mi=j;
}
}
a[mi]=a[mi]+x;
}
ma=a[1];
for(int i=2;i<=m;i++){
if(a[i]>ma){
ma=a[i];
}
}
cout<<ma;
return 0;
}
/*
888
888
888
888
888 88888 d88b
888 d8 8b C8 8D
888 888888D 98 8P
888 q8 98 8P
888888888888 7888P 988P
888 888888888888 d88888b
888 888 888 888
888 888 888 888
888 888 888 888
888 888888888888 888 888
888 888 888 888
888 888 888 888
888 888 888 888
888888888888 888888888888 988888P
88 888
88 88 88
888888888 88 88
8888 88 88
8 88 8 888 88888888 888
8 88 8 88
8 88 8 888888
88 88
88 88
88 88
88 888888888888
d88888b
888 888
888 888
888 888
888 888
888 88 888
888 88888
888 888
988888P 88
(我的个性标志)
*/