Cod sursa(job #1203760)
Utilizator | Data | 1 iulie 2014 11:34:50 | |
---|---|---|---|
Problema | Transport | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.4 kb |
#include <fstream>
using namespace std;
ifstream cin("transport.in");
ofstream cout("transport.out");
long long A[100013],suma,i,n,aux(0),maxim(-1<<18),k;
int main()
{
cin>>n>>k;
for (i=1;i<=n;++i) cin>>A[i], suma+=A[i];
suma/=k; i=0;
while(i<n){
++i;
aux+=A[i];
if (aux>suma) maxim=max(maxim,aux), aux=0;
}
cout<<maxim<<"\n";
return 0;
}