During a competition I came across a problem which at that time I was unable to solve.
But now I have developed a code for that problem. Now I request you people to please better up my logic since in this code the logic is too complex, although it is working correctly.
the problem is:
On the wrapper of a bar of chocolate, the specified amount of componenets must be in NON_INCREASING order. Means
is likely to be true, but
is absolutely wrong.
Now the task is to write a program that determines whether an inscription of components on a chocolate bar.
the input file contains the number of components N(1<=N<=5000). each of the following lines contains the descriptions of one component. each description contain a non-spaced name of component. then there is a space followed by a number 1 or 0. 1 if the % of the component is given and zero if the percentage of component is not given.
A number 00 indicates the end of input file.
Following is the code:
the output of the attached file must be:
void checkarr(int *,int);
printf("Error opening file");
void checkarr(int *amnt,int n)