puzzle_program

number of wickets question

#include <stdio.h>

int main(int argc, char* argv[])
{
int RS1=84,RS2=252,RN1=252,RN2=84; //RUNS
int WS1,WS2,WN1,WN2; //WICKETS
float ratioS1,ratioS2,ratioN1,ratioN2;
float finalRatioS,finalRatioN;
bool bFound = false;

for(WS1=0;(WS1<11);WS1++)
{
for(WS2=0;(WS2<11);WS2++)
{
for(WN1=0;(WN1<11);WN1++)
{
for(WN2=0;(WN2<11);WN2++)
{
if((WN1+WS1) > 10 ) continue;
if((WN2+WS2) > 10 ) continue;
if( (WN1 + WN2) <= (WS1 + WS2) ) continue;

ratioS1 = (float)RS1/(float)WS1;
ratioN1 = (float)RN1/(float)WN1;
if(ratioS1 >= ratioN1) continue;

ratioN2 = (float)RN2/(float)WN2;
ratioS2 = (float)RS2/(float)WS2;
if(ratioS2 >= ratioN2) continue;

finalRatioS = (float)(RS1 + RS2) / (float)(WS1 + WS2);
finalRatioN = (float)(RN1 + RN2) / (float)(WN1 + WN2);
if(finalRatioS <= finalRatioN ) continue;

bFound = true;
printf("Sree Inn1 wickets=%d, Nalan Inn1 Wickets=%d, "
"Sree Inn2 wickets=%d, Nalan Inn2 Wickets=%d \n",WS1,WN1,WS2,WN2);
}
}
}
}
if(bFound)
{
printf("Kittippoyi \n");
}
else
{
printf("Answer can not be found, gurukkal pattichu!!! \n");
}
return 0;
}