Title: There is a box of B, not a box has A1 a small box, each small box inside there are A2 a smaller box, ... ;
The smallest box has AK chocolate, asking for the remainder of the chocolate to be given to n individuals.
Analysis: Simulation, large integer multiplication, remainder operation. Solve a large number of classes directly using Java.
Description: (⊙_⊙) class name if Main.
Import Java.util.Scanner; Import Java.math.BigInteger; Class main{public static void Main (string[] args) { Scanner cin = new Scanner (system.in); int T = Cin.nextint (); int N, B, K; while (T--> 0) { N = Cin.nextint (); B = Cin.nextint (); BigInteger ans = biginteger.valueof (0); while (B--> 0) { K = Cin.nextint (); BigInteger tmp = biginteger.valueof (1); while (K--> 0) { tmp = tmp.multiply (biginteger.valueof (Cin.nextint ())); } Ans = ans.add (tmp); } System.out.println ((Ans.remainder (biginteger.valueof (N))). ToString ());}}}
UVa 10489-boxes of chocolates