Booklet Printing

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

Given the number of pages,
determine the order of pages to print a booklet with 2-up and duplexing.
For example, if the number of pages 8 is given,
output the ordered sequence '8 1 2 7 6 3 4 5'.
When a given number is not multiple of 4, change the order after adding some empty pages '_' at the end of pages.

Options

exec is denied

no deadline, the server will not save your submission

Sample input:_

36

Sample output:

36 1 2 35 34 3 4 33 32 5 6 31 30 7 8 29 28 9 10 27 26 11 12 25 24 13 14 23 22 15 16 21 20 17 18 19

Sample input:_

57

Sample output:

_ 1 2 _ _ 3 4 57 56 5 6 55 54 7 8 53 52 9 10 51 50 11 12 49 48 13 14 47 46 15 16 45 44 17 18 43 42 19 20 41 40 21 22 39 38 23 24 37 36 25 26 35 34 27 28 33 32 29 30 31

Sample input:_

110

Sample output:

_ 1 2 _ 110 3 4 109 108 5 6 107 106 7 8 105 104 9 10 103 102 11 12 101 100 13 14 99 98 15 16 97 96 17 18 95 94 19 20 93 92 21 22 91 90 23 24 89 88 25 26 87 86 27 28 85 84 29 30 83 82 31 32 81 80 33 34 79 78 35 36 77 76 37 38 75 74 39 40 73 72 41 42 71 70 43 44 69 68 45 46 67 66 47 48 65 64 49 50 63 62 51 52 61 60 53 54 59 58 55 56 57

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1leonid680.07732012/02/24 03:50:520B / 24B / 41B
2ukzk690.04122009/12/08 21:30:000B / 31B / 36B
3ksk700.07502009/05/03 16:32:470B / 24B / 45B
4kodera710.26282007/06/18 01:21:510B / ?B / ?B
5yowa720.08502007/09/08 07:02:530B / 28B / 39B
6clock720.05282012/08/13 13:32:090B / 28B / 40B
7ozy4dm730.27522007/02/19 17:21:430B / 28B / 44B
8shinh740.28232007/02/18 23:10:220B / 38B / 33B
9eban960.24322007/02/19 23:08:470B / 37B / 52B
10flagitious(unembeded)1130.33682007/02/19 02:18:210B / 54B / 52B
11tabasa2390.13072007/10/10 15:21:1816B / 102B / 99B

Perl _

RankUserSizeTimeDateStatistics
1teebee520.04182011/10/22 00:56:180B / 17B / 35B
2tails540.05152012/03/30 10:51:220B / 12B / 41B
3ySas620.05542007/12/09 17:54:550B / 26B / 34B
4Mithran740.28372008/01/04 20:30:330B / 36B / 37B
5Hem870.00352011/10/06 23:28:160B / 29B / 57B

Python _

RankUserSizeTimeDateStatistics
1leonid760.14062012/02/27 02:14:310B / 38B / 34B
2hallvabo800.09952010/09/10 13:49:290B / 34B / 43B
3twobit800.21842011/05/13 06:53:260B / 36B / 41B
4nn820.00652010/02/20 10:05:500B / 42B / 38B
5kt3k850.13312007/12/28 04:44:380B / 42B / 36B
6Mark Byers900.36132007/02/26 09:15:420B / 34B / 51B
7shimizu940.34972007/02/23 04:33:010B / ?B / ?B
8mskzzzz1380.32292007/05/19 19:55:070B / 64B / 59B

PHP _

RankUserSizeTimeDateStatistics
1teebee650.08062011/10/21 12:05:021B / 27B / 37B
2o-cn720.02082009/12/30 03:58:511B / ?B / ?B
3beton980.51252007/05/03 06:24:290B / 40B / 57B

Scheme _

RankUserSizeTimeDateStatistics
1hirofummy1360.23902007/02/25 21:51:270B / ?B / ?B
2ma1570.18632007/02/18 21:53:470B / ?B / ?B

Common LISP _

RankUserSizeTimeDateStatistics
1kozima1180.08522010/01/13 09:01:580B / 50B / 53B
2shimizu1290.64512007/02/23 04:36:580B / ?B / ?B
3hebiyan8110.05912015/09/25 17:02:280B / ?B / ?B

Io _

RankUserSizeTimeDateStatistics
1teebee1070.22082013/12/30 05:36:360B / 58B / 47B
2murky-satyr1172.45372008/03/04 12:06:270B / 65B / 48B
3pooq1430.49892011/01/04 19:19:560B / 83B / 56B

JavaScript _

RankUserSizeTimeDateStatistics
1teebee660.10792012/05/25 07:24:020B / 31B / 34B
2nn710.07142012/05/24 22:42:440B / 34B / 35B
3ETHproductions770.06932016/04/17 03:09:450B / 34B / 42B
4murky-satyr910.08262008/06/20 05:35:410B / 41B / 47B
5nanto_vi960.16652007/03/08 00:05:070B / 48B / 48B
6kaki970.00272010/01/12 22:20:340B / 39B / 57B
7motemen980.28962007/03/03 20:00:240B / ?B / ?B
8Dashiva1180.11522007/04/21 03:09:303B / 45B / 66B

Lua _

RankUserSizeTimeDateStatistics
1clock1050.04012012/08/13 13:19:560B / 58B / 34B
2twobit1180.03452011/05/13 08:15:360B / 65B / 40B
3murky-satyr1310.06222008/06/20 05:50:050B / 70B / 48B

Tcl _

RankUserSizeTimeDateStatistics
1clock1520.04832012/08/26 11:01:410B / 76B / 52B
2user1750.38552007/03/02 17:44:290B / ?B / ?B

Xtal _

RankUserSizeTimeDateStatistics
1pooq1030.32862007/08/27 11:55:090B / 46B / 56B

Icon _

RankUserSizeTimeDateStatistics
1clock960.03372012/08/13 13:16:590B / 52B / 39B

Smalltalk _

RankUserSizeTimeDateStatistics
1murky-satyr1340.40632008/04/10 21:49:130B / 69B / 59B
2sumim2280.85582007/02/21 18:10:140B / 133B / 74B

Prolog _

RankUserSizeTimeDateStatistics
1mskzzzz1220.32382007/05/28 02:31:580B / 61B / 57B

BASIC _

RankUserSizeTimeDateStatistics
1*yuko*940.04322011/10/22 18:19:500B / 49B / 32B
2nn1040.00462011/07/16 21:30:070B / 53B / 37B
3pooq1160.15192007/08/01 22:23:350B / 55B / 49B
4yt1330.17572007/02/26 12:28:530B / ?B / ?B

Erlang _

RankUserSizeTimeDateStatistics
151b2140.92092007/12/27 18:50:280B / 102B / 100B
2mskzzzz2351.85742007/06/02 04:28:250B / 118B / 108B

J _

RankUserSizeTimeDateStatistics
1I., S.500.08562011/07/11 21:47:190B / 13B / 37B
2pooq630.19792008/03/05 07:57:300B / 19B / 43B

C _

RankUserSizeTimeDateStatistics
1nn880.00252011/05/08 02:43:270B / 40B / 46B
27gyou930.05092008/01/26 01:01:570B / 41B / 50B
3inaniwa930.00092010/02/16 14:25:060B / 43B / 48B
4ozy4dm960.06082007/02/19 15:55:420B / 42B / 52B
5shinh980.06552007/02/19 10:49:560B / 44B / 52B
6hallvabo980.00172010/09/10 14:23:300B / 45B / 51B
751b990.04922007/12/27 19:13:230B / 45B / 52B
8hinoe1060.06762007/02/19 00:28:090B / 49B / 55B

C++ _

RankUserSizeTimeDateStatistics
1nn1060.00352011/05/08 02:45:090B / 52B / 50B
27gyou1090.66842007/02/24 03:50:570B / 53B / 52B

D _

RankUserSizeTimeDateStatistics
151b1310.02332007/12/27 19:18:420B / 68B / 58B

OCaml _

RankUserSizeTimeDateStatistics
1ksk1240.68862009/05/03 16:16:390B / 65B / 51B
2shinh1390.24002007/02/19 01:53:540B / 74B / 60B
3jijixi2680.29832007/02/18 23:30:370B / 168B / 63B

Haskell _

RankUserSizeTimeDateStatistics
1henkma1020.00382011/09/12 22:57:010B / 55B / 42B
2notogawa1060.04672010/12/01 01:41:120B / 61B / 41B
3rst761060.07872012/06/20 01:01:100B / 56B / 44B
4koyama411070.03852010/12/01 17:22:100B / 59B / 46B
5tanakh1170.08312007/03/08 01:55:570B / ?B / ?B
6_1180.09072007/02/19 10:34:560B / 61B / 55B
7blue1230.12802007/02/19 10:14:010B / ?B / ?B
8emoken1230.09912007/02/20 18:21:410B / ?B / ?B
9tttaki1370.05682009/02/19 20:52:070B / 77B / 49B

Ada _

RankUserSizeTimeDateStatistics
1D1850.11842007/03/30 18:58:020B / 108B / 61B
2yt1990.10012007/03/14 19:10:300B / ?B / ?B

Java _

RankUserSizeTimeDateStatistics
1teebee1190.19552014/11/07 07:07:230B / 61B / 54B
2teebee(nocheat)1260.24282011/10/21 12:37:210B / 70B / 51B
3nn1330.39622011/07/10 11:45:140B / 74B / 54B
4hallvabo1430.47882010/09/10 14:31:290B / 83B / 55B

Pascal _

RankUserSizeTimeDateStatistics
1*yuko*1450.00282011/07/17 01:23:590B / 93B / 36B
2uru1540.00112009/12/20 00:53:070B / 92B / 49B
3yt1930.12862007/03/14 19:09:430B / ?B / ?B

Fortran _

RankUserSizeTimeDateStatistics
1*yuko*1100.04172011/11/11 10:15:300B / 57B / 49B

C# _

RankUserSizeTimeDateStatistics
1teebee1500.16792012/10/29 02:03:500B / 85B / 57B

COBOL _

RankUserSizeTimeDateStatistics
1*yuko*(LF)3830.00792011/07/23 13:51:260B / 271B / 44B

Maxima _

RankUserSizeTimeDateStatistics
1clock1060.46732012/10/31 17:51:520B / 62B / 39B
2pooq1310.59622011/01/04 17:54:280B / 71B / 53B

Octave _

RankUserSizeTimeDateStatistics
1pooq1510.62902011/10/21 22:21:130B / 83B / 63B

REBOL _

RankUserSizeTimeDateStatistics
1clock1210.10432012/08/18 12:06:040B / 58B / 38B

Asymptote _

RankUserSizeTimeDateStatistics
1teebee820.40812011/12/18 00:49:320B / 41B / 39B

AWK _

RankUserSizeTimeDateStatistics
1teebee470.04232011/10/21 12:03:130B / 18B / 29B
2nn520.00402010/01/22 17:36:450B / 21B / 31B
3usa800.06562007/02/19 15:26:560B / 25B / 52B
4eban800.07922007/02/19 23:09:230B / 25B / 52B

sed _

RankUserSizeTimeDateStatistics
1emoken2520.22842008/02/10 17:51:430B / 69B / 151B

bc _

RankUserSizeTimeDateStatistics
1teebee780.04152011/10/21 12:17:080B / 35B / 41B

dc _

RankUserSizeTimeDateStatistics
1tails680.03842011/05/12 09:23:530B / 46B / 22B

xgawk _

RankUserSizeTimeDateStatistics
1teebee470.04832012/05/25 08:26:100B / 18B / 29B

Postscript _

RankUserSizeTimeDateStatistics
1ySas680.53132007/12/26 22:57:2724B / 25B / 18B
2yshl(bin)690.52422007/12/27 06:32:4522B / 27B / 17B
3yshl1100.59232007/12/27 06:32:370B / 77B / 18B

R _

RankUserSizeTimeDateStatistics
1clock850.59122012/10/15 05:37:030B / 41B / 43B
2pooq1120.94102011/01/04 17:32:060B / 46B / 64B
3NikNakk1170.55272014/07/06 06:34:010B / ?B / ?B

Whitespace _

RankUserSizeTimeDateStatistics
1kaz_u1910.01972015/05/28 23:39:360B / 0B / 0B
2%202150.03702015/05/25 17:47:110B / 0B / 0B

Befunge _

RankUserSizeTimeDateStatistics
1kaki1050.00422011/01/06 17:55:070B / 30B / 65B

Aheui _

RankUserSizeTimeDateStatistics
1Puzzlet Chung2180.03192015/03/03 09:58:24210B / 0B / 0B

GolfScript _

RankUserSizeTimeDateStatistics
1clock380.11732012/05/08 14:08:430B / 8B / 29B
2flagitious390.34002008/01/01 15:25:170B / 3B / 35B
3%20600.06672015/05/25 18:43:140B / 18B / 41B

Burlesque _

RankUserSizeTimeDateStatistics
1clock560.05902012/09/23 08:52:550B / 22B / 34B

z80 _

RankUserSizeTimeDateStatistics
1*yuko*580.69602011/07/16 01:54:3131B / 15B / 11B
2ySas750.46122007/12/27 00:19:0639B / 15B / 15B

Vim _

RankUserSizeTimeDateStatistics
1clock470.24132011/12/22 01:10:016B / 26B / 12B
2pla540.19622010/03/16 04:59:584B / 35B / 14B
3nn540.28942010/11/07 23:08:343B / 35B / 15B

goruby _

RankUserSizeTimeDateStatistics
1leonid600.37102012/02/24 04:49:420B / 22B / 34B
2murky-satyr620.38762008/07/26 09:23:170B / 24B / 36B

Groovy _

RankUserSizeTimeDateStatistics
1teebee733.26852011/10/22 18:26:320B / 36B / 36B
2nn823.64662010/01/22 17:38:210B / 39B / 42B
3murky-satyr1039.94692008/02/29 07:05:020B / 51B / 46B

Scala _

RankUserSizeTimeDateStatistics
1pooq11410.60122011/02/19 06:12:590B / 61B / 44B

Logo _

RankUserSizeTimeDateStatistics
1clock1070.04972013/01/30 19:14:240B / 58B / 30B
2pooq1270.03392011/04/03 07:37:080B / 67B / 46B

Language Ranking_

RankLangUserSizeScore
1GolfScriptclock3810000
2AWKteebee478085
3Vimclock478085
4xgawkteebee478085
5JI., S.507600
6Perlteebee527307
7Burlesqueclock566785
8z80*yuko*586551
9gorubyleonid606333
10PHPteebee655846
11JavaScriptteebee665757
12PostscriptySas685588
13dctails685588
14Rubyleonid685588
15Groovyteebee735205
16Pythonleonid765000
17bcteebee784871
18Asymptoteteebee824634
19Rclock854470
20Cnn884318
21BASIC*yuko*944042
22Iconclock963958
23Haskellhenkma1023725
24Xtalpooq1033689
25Befungekaki1053619
26Luaclock1053619
27C++nn1063584
28Maximaclock1063584
29Logoclock1073551
30Ioteebee1073551
31Fortran*yuko*1103454
32Scalapooq1143333
33Common LISPkozima1183220
34Javateebee1193193
35REBOLclock1213140
36Prologmskzzzz1223114
37OCamlksk1243064
38D51b1312900
39Smalltalkmurky-satyr1342835
40Schemehirofummy1362794
41Pascal*yuko*1452620
42C#teebee1502533
43Octavepooq1512516
44Tclclock1522500
45AdaD1852054
46Whitespacekaz_u1911989
47Erlang51b2141775
48AheuiPuzzlet Chung2181743
49sedemoken2521507
50COBOL*yuko*(LF)383992

Referer

Note that, they may contain spoilers.

return top