Four Cardboard Boxes

Problem #109

Tags: puzzle

Who solved this?

Previous:Everyday Problems Next:Order Reconstruction


Joseph has just started a new job in a distribution warehouse which keeps small packaged items in a central location, then ships these items in bulk shipments to store locations when more inventory is needed. Let's imagine the items as small cubes, like cartons containing some sort of conusmer good inside. Here's how the process works:

First a store submits an Order Request for n items to be shipped from the warehouse, then it's Joseph's job to take the items from the shelves, assemble some cardboard boxes, pack the items into the boxes, and then send out the shipment by mail. There are a few requirements from the company on how items are to be packed together.

Problem Statement

Input Data
First line will be Q, the quantity of testcases.
Q lines will then follow, each holding one value n.

Answer
For each testcase provide exactly 4 values of m, such that the squares of those 4 values sum to n. Separate all values by single spaces.
Note that multiple valid answers may exist for the given testcases. Validity of submitted answers will be verified server-side.
If a solution exists using less than 4 boxes, indicate the size of unused boxes as m=0.

Example

input data:
3
4
18
95

answer:
1 1 1 1 3 3 0 0 1 2 3 9
You need to login to get test data and submit solution.