Problem J
The Gossiping System
Input: standard input
Output: standard output
Time Limit: 4 seconds
Memory Limit: 32 MB
A common amusement in almost any society,
though certainly not the most glamorous one, is for its inhabitants to spread rumours
about each other. In the town of
We say that a (n,g,m,r)
- gossiping system is such a
system consisting of n persons divided into g
groups, with m and r as above. The beauty of these
systems lies in their uniformity. The construction seems fair to everyone, and
still all meetings are held in small groups. Since any two groups have a member
in common, information about the activities and people in one group is swiftly
transferred to all the other groups. Furthermore, it is easy for a messenger to
lie if he or she would like to, since the truth is hard to validate due to the
fact that no two persons share more than one group. Unfortunately, there are
several combinations of n, g, and m
for which these systems do not exist!
As a mathematician living in
On the first line of input, is a single
positive integer t. Thereafter t test cases follow. Each test
case consists of one positive number n, 1<n<1050, given in the
standard base 10 representation,
where n specifies the number of persons.
For each test case in the input, output the
text ‘Yes.’ on a line of its own, if
there exists a (n,g,m,2)-gossiping system for any positive
integers g>1 and m>0 for the value of n
in the test case, otherwise output the text ‘No.’.
Sample
Input
5
3
4
5
6
678678658335615
Sample
Output
Yes.
No.
No.
Yes.
Yes.
(Math Lovers’ Contest, Problem Source: Swedish National Programming Contest, arranged by department of Computer Science at Lund Institute of Technology.)