Apple Orchard
Allie has bought a new apple orchard. The orchard has a single file of trees, number
from 1 to N. Each tree has a certain number of ripe apples.
Allie has a rule she wants to follow. She wants to pluck an equal amount of apples fro
each tree from which she collects apples.
Allie can start collecting apples from any tree, but once she starts collecting, she coll
from every consecutive tree until she reaches the last tree she wants to collect from.
the maximum number of apples she can fetch from the orchard
Answers
Answered by
6
Answer:
øŕčhàŕď məæňß àppłə §ëəđ.
I am follow you but mark brainlist
Ī ÆM FŒŁĹØW ÝÖÙ BÜÞ MÅŘĶ BŘÆÌÑŁÏßÞ
Answered by
0
Answer:
#include<stdio.h>
#include<string.h>
int collectionMaxApples(int input1, int input2[])
{
int ans=0;
int mini=999999999;
for(int i=input1-1; i>=0; i--)
{
if(input2[i]<mini)
mini=input2[i];
if((input1-i)*mini>ans)
ans=(input1-i)*mini;
}
return ans;
}
int main()
{
int n=3;
int input2[3]={8,40,77};
printf("%d", collectionMaxApples(n,input2));
return 0;
}
Explanation:
output = 80
Similar questions
Math,
4 months ago
Math,
4 months ago
Social Sciences,
10 months ago
Social Sciences,
10 months ago
English,
1 year ago
English,
1 year ago