Tiling a Weekly Pattern
Fenwick Retail's night crew works a fixed weekly pattern — the same run of shift codes every week, one code per day. To publish a rota covering several weeks, the pattern is laid out end to end: the whole week, then the whole week again, as many times as the rota covers. The days keep their order inside each week, so the code that falls on the first day of week one also falls on the first day of every later week.
Task: Print the rota.
Input
Two lines. The first holds the weekly pattern: whole numbers separated by single spaces, one per day. The second holds a single integer, the number of weeks the rota covers, which is at least 1.
Output
One line holding the rota, separated by single spaces: the pattern written out once per week, back to back, each code a plain integer. A one-week rota is just the pattern itself.
Example:
Input:
1 0 1
2
Output:
1 0 1 1 0 1
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in