integer concatenation

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

You are given number M, and M lines after it.
Each line contains positive integers, separated by single space.
It is possible to concat these integers in one bigger integer.
Find biggest difference between concatenated integer and its reversion.

For example:
You are given 3 positive integers:
1 3 22

It is possible to concat them in 6 ways:
1322
1223
3122
3221
2213
2231

Find that 3221 - 1223 is the biggest difference. And print it (1998).

Options

exec is denied

now post-mortem time, all source codes will be revealed

Sample input:_

1
1 3 22

Sample output:

1998

Sample input:_

6
1 2 3 4
1 9 5 32
3 3 3
99
51
444 44

Sample output:

3087
82962
0
0
36
0

Sample input:_

6
58 7 945 15 3
15 2
1 2 3 4 5 6 7
8649 12321 45
541 514 523 532
12 23 34 45

Sample output:

593900604
-99
6419754
74172962853
387189108306
24017958

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1clock710.08362013/03/30 01:33:380B / 42B / 26B
2leonid710.08042013/03/30 02:30:290B / 46B / 24B
3Histocrat720.06812013/03/02 07:10:530B / 42B / 26B
4ukzk720.06562013/03/10 10:53:370B / 43B / 26B
5jpl740.11152013/03/18 23:11:490B / ?B / ?B

Perl _

RankUserSizeTimeDateStatistics
1tails850.09022013/03/02 13:42:250B / 39B / 42B
2BioFALSE (aut.)1830.06862013/03/02 04:31:020B / 84B / 96B
3BioFALSE (author8260.09012013/03/02 03:47:2344B / 258B / 206B

Python _

RankUserSizeTimeDateStatistics
1leonid1080.13292013/03/02 06:15:490B / 76B / 22B
2Volatility1250.13732013/03/02 09:16:041B / 83B / 33B
3davisagli1310.11582013/03/02 04:41:180B / 85B / 37B
4wilkes1490.12062013/03/05 02:28:210B / ?B / ?B

Io _

RankUserSizeTimeDateStatistics
1pooq1140.27272013/03/02 05:47:100B / 90B / 13B

J _

RankUserSizeTimeDateStatistics
1I., S.620.12742013/03/29 20:48:000B / 13B / 48B

jq _

RankUserSizeTimeDateStatistics
1pooq980.03142019/08/07 10:47:250B / ?B / ?B

R _

RankUserSizeTimeDateStatistics
1pooq1020.42142013/03/25 22:04:170B / 78B / 14B

GolfScript _

RankUserSizeTimeDateStatistics
1tails400.47382013/03/03 00:02:490B / 10B / 30B

Nibbles _

RankUserSizeTimeDateStatistics
1tails130.08782022/02/21 11:20:359B / 3B / 0B

Burlesque _

RankUserSizeTimeDateStatistics
1clock300.46362013/03/03 14:54:030B / 7B / 23B
2clock230.55832013/09/11 19:37:010B / 8B / 15B
3mroman (clock)250.48122013/09/11 18:59:070B / 9B / 16B

Language Ranking_

RankLangUserSizeScore
1Nibblestails1310000
2Burlesqueclock235652
3GolfScripttails403250
4JI., S.622096
5Rubyclock711830
6Perltails851529
7jqpooq981326
8Rpooq1021274
9Pythonleonid1081203
10Iopooq1141140

return to the top page