Number of days after which tank will become empty | Method returns minimum number of days after which tank will become empty ; Driver code
< ? php function minDaysToEmpty ( $ C , $ l ) { if ( $ l >= $ C ) return $ C ; $ eq_root = ( int ) sqrt ( 1 + 8 * ( $ C - $ l ) - 1 ) / 2 ; return ceil ( $ eq_root ) + $ l ; } echo minDaysToEmpty ( 5 , 2 ) , " STRNEWLINE " ; echo minDaysToEmpty ( 6514683 , 4965 ) , " " ; ? >