Monkey Sports
Time limit1sMemory limit128 MB
Assign each of N monkeys to team A or B on each of 7 days so that every pair of monkeys is split across teams on at least one day.
- Level
Medium6 of 10
- Topics
- Combinatorics, Math, Bit manipulation, Implementation
- Solved
- No attempts yet
Problem
Seungmin is a zookeeper who takes care of the monkeys at a zoo. The zoo has N monkeys, numbered 1 through N.
The zoo is holding a 7-day event in which the monkeys play sports matches against each other. Each match is played once a day between team A and team B, and every monkey must take part in the match, though the teams may have different sizes. Each team must have at least one monkey.
To keep the monkeys from getting too friendly with each other, Seungmin wants to arrange the schedule so that every pair of monkeys meets as opponents at least once. Help Seungmin design the match schedule.
Input
The first line gives an integer N (2 ≤ N ≤ 99), the number of monkeys.
Output
Output the team composition on seven lines.
Line i (1 ≤ i ≤ 7) contains a string of length N made up only of the characters 'A' and 'B'. The j-th character of the i-th string is the team that monkey j belongs to on day i.
If there are multiple schedules that form teams as described, output any one of them.