text: Minimum time required to fill a cistern using N pipes | Function to calculate the time ; Driver Code
code: < ? php function T_ime ( $ arr , $ n , $ Emptypipe ) { $ fill = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ fill += 1 / $ arr [ $ i ] ; $ fill = $ fill - ( 1 / $ Emptypipe ) ; return 1 / $ fill ; } $ arr = array ( 12 , 14 ) ; $ Emptypipe = 30 ; $ n = count ( $ arr ) ; echo ( int ) T_ime ( $ arr , $ n , $ Emptypipe ) . " ▁ Hours " ; ? >