UVa 488 - Triangle Wave

488 - Triangle Wave

 * http://acm.uva.es/p/v4/488.html

Summary
Generate a wave of a given frequency and amplitude

Explanation
The obscurity of the problems is within the small number of test cases, but given the one given here should make the problem a lot clearer.

Gotchas

 * There is a blank line after each separate waveform, excluding the last one.

Anyway, don't waste time on REPETITION and also I/O. Just simply use a string and store all output for a triangle in it, then simply write it in output for many times! And runtime will be around 0.280 in this method.
 * There is a lot of input data, and this problem became harder after UVa's immigration,


 * If you use C++, use printf and scanf. With cin and cout you will get TLE.
 * Only if you don't know how to use it correctly.

Input
2

3 2 4 3

Output
1 22 333 22 1

1 22 333 22 1

1 22 333 4444 333 22 1

1 22 333 4444 333 22 1

1 22 333 4444 333 22 1