結果
| 問題 | 
                            No.1629 Sorting Integers (SUM of M)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             SidewaysOwl
                         | 
                    
| 提出日時 | 2021-07-30 21:06:02 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 356 bytes | 
| コンパイル時間 | 369 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 86,016 KB | 
| 最終ジャッジ日時 | 2024-09-15 21:48:35 | 
| 合計ジャッジ時間 | 3,915 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | TLE * 1 -- * 13 | 
ソースコード
from itertools import permutations
import math
n = int(input())
c = list(map(int,input().split()))
ans = 0
nn = math.factorial(n)
for i in range(9):
    if c[i] != 0:
        nn //= math.factorial(c[i])
ans = 0
for i in range(9):
    if c[i] != 0:
        for j in range(n):
            ans += (i+1) * 10 ** j * c[i] * (nn // n)
print(ans % (10 ** 9 + 7) )
            
            
            
        
            
SidewaysOwl