Paths in matrix

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

Count the number of paths in an n x n matrix.
A path starts from the upper left corner and ends at the lower right. A path can go only in the right or down.

Input: size of matrix n
Output: the number of paths

Inspired by
http://www.nichinoken.co.jp/column/shikakumaru/2012/1212_sa.html
which is an entrance exam to a junior high school in Japan.

--nn

Options

exec is denied

no deadline, the server will not save your submission

Sample input:_

1
3
5
7
9
11
12
13
15
17
2
3
4
6
8
9
14
16
13
13
9
8

Sample output:

1
6
70
924
12870
184756
705432
2704156
40116600
601080390
2
6
20
252
3432
12870
10400600
155117520
2704156
2704156
12870
3432

Sample input:_

3
1
4
15
9
2
6
13
1
8
9
7
9

Sample output:

6
1
20
40116600
12870
2
252
2704156
1
3432
12870
924
12870

Sample input:_

2
7
1
8
2
8
1
8
2
8
4
5
9

Sample output:

2
924
1
3432
2
3432
1
3432
2
3432
20
70
12870

Ranking

Perl _

RankUserSizeTimeDateStatistics
1brx380.03552013/01/07 03:20:480B / 16B / 21B
2teebee380.05182013/01/07 06:00:000B / 16B / 21B
3tails380.03522013/01/09 09:26:150B / 16B / 21B
4clock390.17642013/01/02 07:13:260B / 20B / 16B
5llhuii400.19782015/09/10 01:22:220B / 20B / 17B
6kuropikumin630.04662013/01/26 20:24:460B / 22B / 40B

Python _

RankUserSizeTimeDateStatistics
1teebee500.08322014/09/08 00:31:430B / 28B / 21B
2leonid500.09522014/09/27 09:14:110B / 28B / 20B
3recursive520.05612013/01/09 08:06:080B / 30B / 19B
4clock550.07232013/01/03 04:13:000B / 32B / 21B
5llhuii550.08462015/09/09 01:34:350B / 32B / 21B
6hallvabo560.08972012/12/31 05:19:170B / 25B / 30B
7twobit570.07522012/12/31 03:15:360B / 32B / 23B
8rolf610.10992012/12/31 03:31:400B / ?B / ?B

PHP _

RankUserSizeTimeDateStatistics
1teebee600.06972013/01/03 11:25:560B / 28B / 31B

Pike _

RankUserSizeTimeDateStatistics
1clock810.29822015/03/10 02:29:200B / 50B / 29B
2teebee810.25652015/03/10 08:19:160B / 50B / 29B

Scheme _

RankUserSizeTimeDateStatistics
1teebee670.07242013/01/03 19:40:150B / 32B / 31B
2kaki690.06662013/03/25 04:59:150B / 26B / 39B

Common LISP _

RankUserSizeTimeDateStatistics
1teebee580.35342013/01/02 08:47:070B / 24B / 30B
2clock580.13932013/01/03 19:48:000B / 24B / 30B

Arc _

RankUserSizeTimeDateStatistics
1clock542.76092013/01/03 19:37:000B / 25B / 22B
2teebee542.66782014/05/31 19:05:200B / 25B / 22B

Io _

RankUserSizeTimeDateStatistics
1clock780.20502015/02/22 00:53:550B / 56B / 19B
2teebee780.21482015/02/22 01:10:170B / 57B / 18B
3pooq870.19862012/12/30 22:16:320B / 69B / 13B

JavaScript _

RankUserSizeTimeDateStatistics
1teebee500.04842012/12/30 20:58:130B / 29B / 21B
2clock500.04442013/01/02 06:58:070B / 29B / 21B
3nn520.05172013/01/01 23:34:150B / 30B / 22B
4nn(for check)1390.09312012/12/30 19:51:330B / 76B / 57B

Lua _

RankUserSizeTimeDateStatistics
1clock630.03452013/01/03 19:51:350B / 40B / 17B
2teebee630.03632013/01/03 21:14:170B / 40B / 17B
3AndoDaan1690.03352014/08/10 08:55:370B / 107B / 36B

Xtal _

RankUserSizeTimeDateStatistics
1teebee670.05382012/12/31 04:41:580B / 38B / 28B
2clock670.04722013/09/28 08:56:330B / 38B / 28B

SNOBOL _

RankUserSizeTimeDateStatistics
1clock910.03532013/02/04 21:03:140B / 38B / 23B

REXX _

RankUserSizeTimeDateStatistics
1teebee560.03652012/12/30 20:54:200B / 35B / 8B
2clock560.03802013/01/02 06:55:370B / 35B / 8B
3*yuko*560.03942014/03/19 23:13:220B / 35B / 15B

PARI/GP _

RankUserSizeTimeDateStatistics
1clock340.04372012/12/31 20:21:570B / 20B / 14B
2teebee340.07322013/01/02 09:18:520B / 20B / 14B
3mitchs340.04302015/02/07 05:56:230B / 20B / 14B
4Hendrik340.04412015/06/16 00:41:470B / 20B / 14B

Cyan _

RankUserSizeTimeDateStatistics
1clock553.29762013/02/03 19:23:120B / 30B / 24B
2teebee552.91002013/03/03 06:57:320B / 30B / 24B
3pooq803.08562013/01/03 15:41:440B / 45B / 34B

Smalltalk _

RankUserSizeTimeDateStatistics
1clock590.07022013/01/04 20:39:210B / 41B / 16B
2teebee590.04762014/06/11 07:22:210B / 41B / 16B
3pooq740.06472013/01/04 17:19:490B / 45B / 25B

Prolog _

RankUserSizeTimeDateStatistics
1pooq1040.14182013/01/03 13:35:290B / 51B / 42B

BASIC _

RankUserSizeTimeDateStatistics
1teebee540.04822012/12/31 04:30:280B / 35B / 15B
2clock540.05092013/01/02 06:53:520B / 35B / 12B

J _

RankUserSizeTimeDateStatistics
1pooq230.18642012/12/30 21:24:150B / 6B / 17B
2Hendrik230.07022014/09/03 23:00:260B / 6B / 17B
3random340.07242013/06/02 23:03:110B / ?B / ?B
4medialuna400.05492014/11/23 22:51:230B / ?B / ?B

K _

RankUserSizeTimeDateStatistics
1teebee230.03662013/01/06 04:12:000B / 6B / 17B

C _

RankUserSizeTimeDateStatistics
1llhuii740.03542015/09/09 01:30:570B / 36B / 38B
2inaniwa750.03222013/01/05 22:09:350B / 39B / 36B
3nu750.03202013/01/06 18:19:080B / 39B / 36B
4nn770.03222013/01/01 23:57:360B / 41B / 36B
5ush790.03662013/01/05 09:36:020B / 40B / 39B
6amat1320.03222013/01/03 14:14:020B / 60B / 71B

Haskell _

RankUserSizeTimeDateStatistics
1henkma630.05202013/01/01 02:30:350B / 40B / 21B

ObjC _

RankUserSizeTimeDateStatistics
1llhuii740.03182015/09/09 01:31:340B / 36B / 38B

Fortran _

RankUserSizeTimeDateStatistics
1teebee610.03862012/12/31 04:10:290B / 36B / 22B
2clock610.05282013/01/03 19:53:450B / 36B / 22B
3*yuko*610.04032013/01/31 01:38:200B / 36B / 22B

Maxima _

RankUserSizeTimeDateStatistics
1clock540.22742013/01/01 06:23:320B / 28B / 25B
2teebee540.24462013/01/02 05:49:520B / 28B / 25B

REBOL _

RankUserSizeTimeDateStatistics
1teebee740.08682013/01/03 20:26:000B / 40B / 20B
2clock740.08122013/01/04 03:02:580B / 40B / 18B

Asymptote _

RankUserSizeTimeDateStatistics
1teebee390.25342012/12/30 20:07:190B / 26B / 12B
2clock390.25442013/01/02 20:23:460B / 26B / 12B

AWK _

RankUserSizeTimeDateStatistics
1llhuii310.03642015/09/09 01:41:420B / 12B / 19B
2teebee310.03842015/09/09 06:45:220B / 13B / 18B
3nn320.03152013/01/01 23:32:140B / 14B / 18B
4clock340.03192013/01/02 07:00:090B / 15B / 19B

jq _

RankUserSizeTimeDateStatistics
1teebee520.03902014/11/29 06:56:390B / 27B / 23B
2clock520.03482015/02/11 02:14:430B / 27B / 23B

xgawk _

RankUserSizeTimeDateStatistics
1llhuii310.03382015/09/09 01:41:470B / 12B / 19B
2teebee310.05072015/09/09 06:46:520B / 13B / 18B
3mitchs320.03272015/09/10 01:08:250B / 13B / 19B

R _

RankUserSizeTimeDateStatistics
1teebee420.44952012/12/30 21:51:290B / 27B / 15B
2clock420.45902013/01/01 05:31:240B / 27B / 15B

QCL _

RankUserSizeTimeDateStatistics
1pooq1300.06132013/01/03 17:17:570B / 79B / 37B

Brainfuck _

RankUserSizeTimeDateStatistics
1g33k3810.03242013/01/29 15:20:0545B / ?B / ?B

GolfScript _

RankUserSizeTimeDateStatistics
1tails220.12932013/01/09 19:28:370B / 3B / 19B
2clock230.06892013/01/01 21:57:340B / 3B / 20B

gs2 _

RankUserSizeTimeDateStatistics
1mitchs100.35822015/09/08 11:53:572B / 4B / 4B

Burlesque _

RankUserSizeTimeDateStatistics
1teebee130.03772014/09/17 06:44:490B / 9B / 4B
2Hendrik130.03692014/09/22 17:04:190B / 9B / 4B
3clock130.03822015/01/23 01:28:450B / 9B / 4B

Groovy _

RankUserSizeTimeDateStatistics
1teebee592.69472014/09/01 04:36:570B / 39B / 19B
2clock652.83832013/01/03 19:15:390B / 47B / 17B
3nn652.95802013/01/03 19:43:150B / 47B / 17B

Logo _

RankUserSizeTimeDateStatistics
1teebee430.09012012/12/30 20:48:080B / 26B / 15B
2clock430.07402013/01/28 14:17:440B / 26B / 15B

Language Ranking_

RankLangUserSizeScore
1gs2mitchs1010000
2Burlesqueteebee137692
3GolfScripttails224545
4Jpooq234347
5Kteebee234347
6AWKllhuii313225
7xgawkllhuii313225
8PARI/GPclock342941
9Perlbrx382631
10Asymptoteteebee392564
11Rteebee422380
12Logoteebee432325
13JavaScriptteebee502000
14Pythonteebee502000
15jqteebee521923
16BASICteebee541851
17Maximaclock541851
18Arcclock541851
19Cyanclock551818
20REXXteebee561785
21Common LISPteebee581724
22Smalltalkclock591694
23Groovyteebee591694
24PHPteebee601666
25Fortranteebee611639
26Haskellhenkma631587
27Luaclock631587
28Xtalteebee671492
29Schemeteebee671492
30REBOLteebee741351
31Cllhuii741351
32ObjCllhuii741351
33Ioclock781282
34Pikeclock811234
35SNOBOLclock911098
36Prologpooq104961
37QCLpooq130769
38Brainfuckg33k381262

return top