![]() |
||||||||||
|
||||||||||
HearthstoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1 Accepted Submission(s): 1 Problem Description Cdfpysw loves playing a card game called "Hearthstone". Now he has N cards, he wants to split these cards into 4 piles. Let's assume the number of cards in each pile is a1, a2, a3, a4. It must be satisfied that: a1 * k1 = a2 + a3 + a4 a2 * k2 = a1 + a3 + a4 a3 * k3 = a1 + a2 + a4 a1, a2, a3, a4 must be positive Because Cdfpysw is clever, there must be a way to split there card. Can you tell Cdfpysw what is the way? Input The first line is an integer T, means the number of cases. Then T lines, each line contains 4 integers, N, k1, k2, k3, meaning of these have been shown in the description. T <= 100 1 <= N <= 109 1 <= k1, k2, k3 <= 200 Output For each case, you should output "Case #i: " first, i is the case number. Then output 4 integers a1, a2, a3, a4, represent the number of cards in each pile. Sample Input
Sample Output
Source | ||||||||||
|