Set of Rectangles
Time limit2sMemory limit128 MB
Given a wire length L, choose the largest set of Pythagorean rectangles with distinct aspect ratios whose total perimeter fits in L.
Problem
A Pythagorean triple is three positive integers , , with , written as . Picking integers and with and setting , , produces a Pythagorean triple.
is a set of rectangles. Rectangle has width , height , and diagonal length . When every rectangle in satisfies the conditions below, the set is called a Pythagorean base rectangle set.
- is a Pythagorean triple.
- whenever
Changyoung, a student at Pythagoras High School, plays with a wire of length . He cuts the wire into pieces and bends each piece into one rectangle, and the set of rectangles he ends up with must be a Pythagorean base rectangle set. Making uses of wire.
Write rectangle as the pair of width and height . When is 94, Changyoung can make 3 rectangles, for instance . Building from the same wire leaves him with only 2 rectangles.
Given , write a program that finds the largest number of rectangles Changyoung can make.
Input
The first line contains the number of test cases . Each test case is a single line holding the wire length . ()
Output
For each test case, print on one line the largest number of rectangles Changyoung can make from a wire of length .