http://www.spoj.com/problems/EBOXES/
BRUTE FORCE
MAKE EQUATIONS AND SOLVE IT...
Let intial no. of boxes be N and let X1,X2,...............,X(T) be the no. of selected boxes in T trials
Let K be no. of smaller boxes kept in each larger boxes.
No. of empty boxes would be=:
N -X1 + (K*X1-X2) + (K*X2-X3)....................+(K*X(T-1)-X(T))+K*X(T)=F
N + K*(X1+X2...........+X(T)) - (X1+X2...........+X(T))=F
(X1+X2............+X(T))=(F-N)/(K-1)
Total no. of boxes would be=:
N+K*(X1+X2...........+X(T)) => N+K*((F-N)/(K-1))
BRUTE FORCE
MAKE EQUATIONS AND SOLVE IT...
Let intial no. of boxes be N and let X1,X2,...............,X(T) be the no. of selected boxes in T trials
Let K be no. of smaller boxes kept in each larger boxes.
No. of empty boxes would be=:
N -X1 + (K*X1-X2) + (K*X2-X3)....................+(K*X(T-1)-X(T))+K*X(T)=F
N + K*(X1+X2...........+X(T)) - (X1+X2...........+X(T))=F
(X1+X2............+X(T))=(F-N)/(K-1)
Total no. of boxes would be=:
N+K*(X1+X2...........+X(T)) => N+K*((F-N)/(K-1))
sir this line N -X1 + (K*X1-X2) + (K*X2-X3)....................+(K*X(T-1)-X(T))+K*X(T)=F
ReplyDeleteI am not able to understand will you please explain it??