Submit | All submissions | Best solutions | Back to list |
PAS - Pascal Triangle |
No more boring stories ;) A straightforward question. Given a number N print a Pascal Triangle of size N.
For example a Pascal Triangle of size 5 looks like this:
1 2 1 2 3 2 1 2 3 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5
Input
The first line contains a number T – number of test cases.
Each of the next T lines has an integer (1 <= N <= 15)
Output
Print the required output (use tab seperators not spaces)
After the last line print an extra blank line as in:
“5t4t3t2t1t2t3t4t5nn”
Example
Input: 1 5 Output: 1 2 1 2 3 2 1 2 3 4 3 2 1 2 3 4 5 4 3 2 1 2 3 4 5
Added by: | n.7n |
Date: | 2013-09-21 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Common problem |
hide comments
2023-03-20 22:18:02 Simes
It's a triangle, but it's not Pascal's. Pascal's triangle begins 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 |