1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
int n;
cin >> n;
int array1[n];
int array2[n];
array2[0]=array1[0];
for(int i=0; i<n; i++)
{
cin >> array1[i];
}
for(int i=1; i<n; i++)
{
array2[i]=array1[i-1]+array1[i];
}
int a=n/3, b=2*(n/3);
int suma=array2[a-1], sumb=array2[b-1]-suma, sumc=array2[n-1]-sumb-suma;
int maxnum=max(suma, max(sumb, sumc));
if(max((array2[a-i],(sumb+array1[a-i]))<maxnum))
{
a--;
int suma=array2[a-i], sumb=array2[b-i]-suma, sumc=array2[n-1]-sumb-suma;
}
if(max((array2[a-],(sumb+array1[a-i]))<maxnum))
{
a--;
int suma=array2[a-i], sumb=array2[b-i]-suma, sumc=array2[n-1]-sumb-suma;
}
if(max((array2[a-i],(sumb+array1[a-i]))<maxnum))
{
a--;
int suma=array2[a-i], sumb=array2[b-i]-suma, sumc=array2[n-1]-sumb-suma;
}
if(max((array2[a-i],(sumb+array1[a-i]))<maxnum))
{
a--;
int suma=array2[a-i], sumb=array2[b-i]-suma, sumc=array2[n-1]-sumb-suma;
}
|