結果
| 問題 | No.389 ロジックパズルの組み合わせ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-07-14 00:27:24 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 307 ms / 2,000 ms | 
| コード長 | 228 bytes | 
| コンパイル時間 | 1,121 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 18,576 KB | 
| 最終ジャッジ日時 | 2024-11-09 00:26:50 | 
| 合計ジャッジ時間 | 9,085 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 99 | 
ソースコード
from math import comb
MOD = 10 ** 9 + 7
M = int(input())
H = list(map(int, input().split()))
if H == [0]:
    print(1)
    exit()
L = len(H)
W = M - sum(H)
if W < L - 1:
    print('NA')
    exit()
print(comb(W + 1, L) % MOD)
            
            
            
        