I tried to consider almost all the test cases for the question CodeChef: Practical coding for everyone still the solution was not being accepted on the grounds of wrong answer , the solution is attached herewith :
#include<stdio.h>
#include<stdlib.h>
int main()
{
int testcases,r,o,s,totalrun[1000],i=0,j,k=0;
double p;
double totalrate[1000];
scanf(“%d”,&testcases);
while(testcases–)
{
scanf("%d %d %d",&o,&r,&s);
if(o >50 || r > 36 || s > 36 || o <= 0 || r <= 0 || s <= 0)
{
exit(0);
}
totalrun[i++]=(o*r)+s;
//printf("%d\n",totalrun[i-1]);
if(o==50)
{
totalrate[k++]=r*1.0;
printf("\n%.2f",totalrate[k-1]);
}
else
{
totalrate[k++]=(totalrun[i-1]/(o+1.0));
printf("\n%.2f",totalrate[k-1]);
}
}
/*for(j=0;j<k;j++)
{
printf("\n%.2f",totalrate[j]);
}*/
return 0;
}
Please consider the code and find the possible mistakes …