1 /*
2 * Author: Quickgrid ( Asif Ahmed )
3 * Site: https://quickgrid.wordpress.com
4 * Problem: UVA 488 ( Triangle Wave )
5 */
6 #include<stdio.h>
7
8 /* For this problem amplitude does not exceed 9, so you can cheat <span class="wp-smiley wp-emoji wp-emoji-smile" title=":)">:)</span> */
9 const char *a[] = {"", "1", "22", "333", "4444", "55555", "666666", "7777777", "88888888", "999999999"};
10
11 int main(){
12 register unsigned n, i, j, k;
13 scanf("%u", &n);
14
15 while(n--){
16 unsigned amp, times;
17 scanf("%u%u", &, ×);
18
19 while(times--){
20 for(i = 1; i < amp; ++i)
21 /* Just print the predefined strings */
22 printf("%s
", a[i]);
23
24 for(k = i; k; --k)
25 printf("%s
", a[k]);
26
27 if(times || n)
28 printf("
");
29 }
30 }
31 return 0;
32 }