Type: Default 1000ms 256MiB

string

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

string

题目描述

给定 NN 个由X 和数字构成的字符串,你需要对其进行排列并拼接成新的字符串 TT 以最大化其分数。定义其分数为对于字符串中每一个数字,使数字对应的数值乘上其之前X 的数量,并求和。

输出分数最大值。

输入格式

NN

S1S_1

...

SNS_N

输出格式

输出答案

样例

3
1X3
59
XXX
71
10
X63X395XX
X2XX3X22X
13
3716XXX6
45X
X6XX
9238
281X92
1XX4X4XX6
54X9X711X1
3010

数据范围与提示

  • 2N21052 \leq N \leq 2*10^5
  • SiS_i 只包括 1 91~9 的数字或 XX
  • S1,S2...SNS_1,S_2 ... S_N 长度和不超过 21052*10^5

0226B

Not Attended
Status
Done
Rule
IOI
Problem
4
Start at
2026-2-26 8:00
End at
2026-2-26 11:39
Duration
3.7 hour(s)
Host
Partic.
80