UVa 488

From Algorithmist
Jump to navigation Jump to search

488 - Triangle Wave[edit]

Summary[edit]

Generate a wave of a given frequency and amplitude

Explanation[edit]

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[edit]

  • There is a blank line after each separate waveform, excluding the last one.
  • There is a lot of input data, and this problem became harder after UVa's immigration,

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.

  • 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[edit]

2

3
2
4
3

Output[edit]

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

Solutions[edit]