Time limit: 7s Source limit: 50000B Memory limit: 256MB The first line contains the number of test cases T. T lines follow, one corresponding to each test case, containing 2 integers: N and P. OUTPUT 3 6 EXPLANATIONIn the first test case, the possi…
Description There are N stones, which can be divided into some piles arbitrarily. Let the value of each division be equal to the product of the number of stones in all the piles modulo P. How many possible distinct values are possible for a given N a…
RXD and dividing Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1893 Accepted Submission(s): 809 Problem Description RXD has a tree T, with the size of n. Each edge has a cost.Define f(S) …
题目: Squirrel Liss liv Escape from Stonesed in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, n stones will fall and Liss will escape from the stones. The st…
Problem Description RXD has a tree T, with the size of n. Each edge has a cost.Define f(S) as the the cost of the minimal Steiner Tree of the set S on tree T. he wants to divide 2,3,4,5,6,…n into k parts S1,S2,S3,…Sk,where ⋃Si={2,3,…,n} and for all d…