are two potential results of a game: the game might bring about a tie, then, at that point, the two groups get 1 point; one group may dominate in a match, then, at that point, the triumphant group gets 3 focuses and the losing group gets 0 focuses.
Correct answer will be upvoted else downvoted. Computer science.
There are two potential results of a game:
the game might bring about a tie, then, at that point, the two groups get 1 point;
one group may dominate in a match, then, at that point, the triumphant group gets 3 focuses and the losing group gets 0 focuses.
The score of a group is the number of focuses it acquired during all games that it played.
You are keen on a theoretical circumstance when all groups get a similar score toward the finish of the title. A basic illustration of that circumstance is the point at which all games bring about ties, however you need to limit the number of ties too.
Your assignment is to depict a circumstance (pick the aftereffect of each game) so that all groups get a similar score, and the number of ties is the base conceivable.
Input
The main line contains one integer t (1≤t≤100) — the number of experiments.
Then, at that point, the experiments follow. Each experiment is portrayed by one line containing one integer n (2≤n≤100) — the number of groups.
Output
For each experiment, print n(n−1)2 integers portraying the aftereffects of the games in the accompanying request: the primary integer ought to compare to the match between group 1 and group 2, the second — between group 1 and group 3, then, at that point, 1 and 4, ..., 1 and n, 2 and 3, 2 and 4, ..., 2 and n, etc, until the game between the group n−1 and the group n.
The integer relating to the game between the group x and the group y ought to be 1 if x successes, −1 if y wins, or 0 if the game outcomes in a tie.
All groups ought to get a similar score, and the number of ties ought to be the base conceivable. In case there are numerous ideal replies, print any of them. It tends to be shown that there consistently exists a way of making all groups have a similar score
Step by step
Solved in 3 steps with 1 images