Crosswire you forced me to code even though i am on a break. Here is the coded solution that i suggested.
It should work for some cases.....................
Code:
// Name : Coachdpd
// Program : Window Washer
// Description : A problem that tell the quickest time to get a group of people
// to wash the windows of a building.
// Date : August 20, 2005
// Last Updated: 4, 2005
#include <stdio.h>
#include <conio.h>
#define num 10
void main()
{
float height, width, washTime[num] = {0}, totalWashTime = 0,totalTime = 0;
int jobTime, count = 0, x, y;
do
{
printf("Enter Height of Building: " );
scanf( "%f", &height );
printf("\nEnter Width of Building: " );
scanf( "%f", &width );
}while(height == 0 && width == 0 );
do
{
printf("\nEnter each wash person's time: " );
scanf( "%f", &washTime[count] );
totalWashTime += washTime[count];
count++;
}while( count < num && washTime[count - 1 ] != 0 );
y = count - 2;
for( x = 0; x < count - 1; x++ )
{
if( (washTime[ x ] / totalWashTime) * (height) >= 1 )
jobTime = (washTime[ x ] / totalWashTime) * (height * width) * washTime[ y ];
if( totalTime < jobTime )
totalTime = jobTime;
y--;
}
printf("\nTotal Time = %.0f secs", totalTime );
getch();
}