Submit | All submissions | Best solutions | Back to list |
PASCAL_T - Pascal’s triangle |
Wersja polska | English version |
Dla podanej liczby n wypisz nty wiersz trójkąta Pascala.
1 - zerowa linia
1 1 - pierwsza linia
1 2 1 - druga linia
1 3 3 1 - trzecia linia
1 4 6 4 1 - czwarta linia
...
Input
Pierwsza linia zawiera liczbę testów t. W kolejnych t liniach znajduje się liczba naturalna n (0<=n<101).
Output
Dla każdego testu jedna linia - nty wiersz z trójkąta Pascala.
Przykład
Wejście:
2
7
0
Wyjście:
1 7 21 35 35 21 7 1
1
Added by: | Piotr Kąkol |
Date: | 2009-12-22 |
Time limit: | 6s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: SCM qobi |
Resource: | Pascal's triangle |
hide comments
|
|||||
2013-12-07 21:05:46 Piotr KÄ…kol
By using dc. |
|||||
2013-12-07 15:26:08 Linghui Liu
@piotr, can you give a hint to get around awk big problem? With 253338471349988640(about 2^58)*5 awk gives wrong answer. |
|||||
2013-11-22 15:10:19 Linghui Liu
Just curious about the awk AC. How can awk avoid the big problem? |
|||||
2013-04-26 21:50:34 Piotr KÄ…kol
@jayavasanth - For n=45 you print negative numbers. |
|||||
2012-11-22 13:15:30 jayavasanth
i m getting answer correct answer for all inputs... but it says wrong output :( idk why |
|||||
2010-04-27 16:00:25 Piotr KÄ…kol
No problem. I'm glad that I helped You at least in that way. ;-) |
|||||
2010-04-27 06:54:29 Zoltán Zámbori
Thank You! Now i see that bigrat gives "wrong answare" too. Sorry for wasting Your time. |
|||||
2010-04-26 14:21:42 Piotr KÄ…kol
If You want to check Your answers here is output for 100th line of Pascal's triangle. |
|||||
2010-04-25 16:17:19 Zoltán Zámbori
I use bigrat in the code. Bigint give "wrong result". At home it needs 32 sec to print n=100. (I don't know the result is correct or not.) Last edit: 2010-04-25 16:35:24 |
|||||
2010-04-25 15:12:33 Piotr KÄ…kol
So I increased time limit to 20sec and it's still not enought for Your TLE submitions. As for big numbers in Perl it's yet bigint which satisfy task conditions. There are also very few tests so it shouldn't be a problem with even strict time limit. |