Created
February 3, 2013 08:37
-
-
Save Abreto/4700958 to your computer and use it in GitHub Desktop.
UVa 488 - Triangle Wave.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* UVa 488 - Triangle Wave. */ | |
#include <stdio.h> | |
int main() | |
{ | |
int i = 0, j = 0, k = 0; | |
int T = 0; | |
int A = 0, F = 0; | |
int fcount = 0; | |
int h = 0; | |
scanf("%d", &T); | |
while(T--) | |
{ | |
scanf("%d\n%d", &A, &F); | |
for(i = 0;i < F;i++) | |
{ | |
if( fcount > 0 ) | |
printf("\n"); | |
for(j = 0;j < 2*A-1;j++) | |
{ | |
h = ((j+1)>A)?(A-(((j)%A)+1)):(j+1); | |
for(k = 0;k < h;k++) | |
printf("%d", h); | |
printf("\n"); | |
} | |
fcount ++; | |
} | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment