結果

問題 No.2734 Addition and Multiplication in yukicoder (Hard)
ユーザー GGanari
提出日時 2024-04-19 23:24:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 612 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 82,020 KB
実行使用メモリ 142,900 KB
最終ジャッジ日時 2024-10-11 18:00:51
合計ジャッジ時間 9,888 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()
num = input().split()
num.sort(reverse=True)
index = 9
result = []

max2 = 0
for i in num:
  max2 = max(len(i), max2)

a = []
index = 0
for i in num:
  p = 0
  m = len(i)
  l = 0
  while True:
    if len(i) == max2:
      break
    
    if max2 - m == 1:
        i += str(max(i))
        break
    i += i[p]
    p+= 1
    l += 1
    if p == m:
        p == 0
  a.append([i, index])
  index += 1
a.sort(key=lambda x: (x[0]), reverse=True)
for i in range(len(a)):
  result.append(num[a[i][1]])
res = 0
result.reverse()
for i in result:
    res*= 10**len(i)
    res+=int(i)
    res%=998244353
print(res)
0