A packaging line moves n items past two inspection stations, numbered 1 to n in order along the belt. Station Alpha calls out for every item whose position is a multiple of a given spacing p; Station Bravo calls out for every item whose position is a multiple of a given spacing q. Both stations watch the same belt and call out independently and instantly, so when an item's position is a multiple of both p and q, both stations call out for it at once. For each item, report what was heard: if only Alpha called, report "Alpha"; if only Bravo called, report "Bravo"; if both called simultaneously, report "AlphaBravo" (Alpha's call listed first); if neither called, report the item's position number instead.
A single line containing three integers: n, p, q.
Print n lines. The i-th line (for i = 1 to n, in order) contains the report for item i, following the rule above.
1 <= n <= 2000 1 <= p <= 2000 1 <= q <= 2000
Example 1
Input
15 3 5
Expected
1 2 Alpha 4 Bravo Alpha 7 8 Alpha Bravo 11 Alpha 13 14 AlphaBravo
Explanation
Alpha calls on every multiple of 3 and Bravo calls on every multiple of 5. Item 15 is a multiple of both, so it reports 'AlphaBravo'; items 3, 6, 9, 12 report 'Alpha'; items 5, 10 report 'Bravo'; every other item (1, 2, 4, 7, 8, 11, 13, 14) reports its own number.
Example 2
Input
6 2 3
Expected
1 Alpha Bravo Alpha 5 AlphaBravo
Explanation
Alpha calls on multiples of 2, Bravo on multiples of 3. Item 6 is a multiple of both and reports 'AlphaBravo'; items 2 and 4 report 'Alpha'; item 3 reports 'Bravo'; items 1 and 5 report their own numbers.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →