結果

問題 No.389 ロジックパズルの組み合わせ
ユーザー shinchanshinchan
提出日時 2020-10-26 23:41:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 152,420 KB
最終ジャッジ日時 2023-09-29 03:01:36
合計ジャッジ時間 23,342 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 158 ms
99,536 KB
testcase_01 WA -
testcase_02 AC 156 ms
99,676 KB
testcase_03 WA -
testcase_04 AC 158 ms
99,308 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 165 ms
103,180 KB
testcase_10 AC 166 ms
101,636 KB
testcase_11 AC 166 ms
105,660 KB
testcase_12 AC 165 ms
101,184 KB
testcase_13 AC 187 ms
124,320 KB
testcase_14 AC 166 ms
105,772 KB
testcase_15 AC 164 ms
100,220 KB
testcase_16 AC 162 ms
101,988 KB
testcase_17 AC 171 ms
104,740 KB
testcase_18 AC 209 ms
145,772 KB
testcase_19 AC 157 ms
99,660 KB
testcase_20 AC 157 ms
99,488 KB
testcase_21 AC 158 ms
99,472 KB
testcase_22 AC 159 ms
99,488 KB
testcase_23 AC 161 ms
99,712 KB
testcase_24 AC 160 ms
99,844 KB
testcase_25 AC 156 ms
99,804 KB
testcase_26 AC 157 ms
99,516 KB
testcase_27 AC 164 ms
99,420 KB
testcase_28 AC 161 ms
99,512 KB
testcase_29 AC 160 ms
99,512 KB
testcase_30 AC 154 ms
99,316 KB
testcase_31 AC 162 ms
99,360 KB
testcase_32 AC 158 ms
99,400 KB
testcase_33 AC 162 ms
99,408 KB
testcase_34 AC 161 ms
99,444 KB
testcase_35 AC 162 ms
99,436 KB
testcase_36 AC 162 ms
99,356 KB
testcase_37 AC 161 ms
99,476 KB
testcase_38 AC 160 ms
99,440 KB
testcase_39 AC 154 ms
99,480 KB
testcase_40 AC 157 ms
99,352 KB
testcase_41 AC 158 ms
99,320 KB
testcase_42 AC 159 ms
99,312 KB
testcase_43 AC 158 ms
99,380 KB
testcase_44 AC 167 ms
99,444 KB
testcase_45 AC 160 ms
99,396 KB
testcase_46 AC 159 ms
99,716 KB
testcase_47 AC 156 ms
99,316 KB
testcase_48 AC 154 ms
99,388 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 WA -
testcase_68 WA -
testcase_69 AC 155 ms
99,316 KB
testcase_70 AC 155 ms
99,512 KB
testcase_71 AC 152 ms
99,536 KB
testcase_72 AC 152 ms
99,436 KB
testcase_73 AC 155 ms
99,400 KB
testcase_74 AC 152 ms
99,532 KB
testcase_75 AC 149 ms
99,444 KB
testcase_76 AC 154 ms
99,716 KB
testcase_77 AC 153 ms
99,316 KB
testcase_78 AC 150 ms
99,380 KB
testcase_79 AC 157 ms
99,380 KB
testcase_80 AC 155 ms
99,520 KB
testcase_81 AC 152 ms
99,392 KB
testcase_82 AC 149 ms
99,308 KB
testcase_83 AC 153 ms
99,396 KB
testcase_84 AC 142 ms
99,508 KB
testcase_85 AC 151 ms
99,564 KB
testcase_86 AC 153 ms
99,628 KB
testcase_87 AC 161 ms
99,512 KB
testcase_88 AC 157 ms
99,516 KB
testcase_89 AC 174 ms
114,580 KB
testcase_90 AC 184 ms
124,920 KB
testcase_91 AC 218 ms
135,428 KB
testcase_92 AC 166 ms
104,632 KB
testcase_93 AC 191 ms
127,928 KB
testcase_94 AC 160 ms
99,864 KB
testcase_95 AC 193 ms
131,580 KB
testcase_96 AC 185 ms
121,484 KB
testcase_97 AC 180 ms
121,520 KB
testcase_98 AC 174 ms
108,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

m = int(input())
a = list(map(int,input().split()))

N = 1000010
mod = 1000000007
fac = [1] * N
finv = [1] * N
inv = [1] * N

for i in range(2, N):
	fac[i] = fac[i - 1] * i % mod
	inv[i] = mod - inv[mod % i] * (mod // i) % mod
	finv[i] = finv[i - 1] * inv[i] % mod

def com(n, k):
	if n < k:
		exit(0)
	if n < 0 or k < 0:
		exit(0)
	return fac[n]*(finv[k]*finv[n - k]%mod) %mod

def calc(n, k):
	return com(n + k - 1, n)
s = len(a)

ans = calc(m - (sum(a) + s - 1), s + 1)
if ans == 0:
	print("NA")
else:
	print(ans)
0