I encountered this issue solving a competitive programming challenge [Easy]
Given a number of workers ‘x’ that need ‘d’ days to a work to be done:
what are the amount of days less if are added ‘y’ workers?
int main(){
// ((d / x) * y) != ((x * p)/(x + y)) * y) ?
return 0;
}
I use Visual Studio.
I tried this formula ((d / x) * y) did not worked.
then I tried this ((x * p)/(x + y)) * y)
and result is different and I don’t understand why… and aso give an error.
Can someone explain me why two formulas are not equal?
I used all kind of precision data and I need an integer (less than 1 day is 0).
I also tried: if(result < 0){result = d;} …
pvt-Tron is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.