結果
問題 |
No.389 ロジックパズルの組み合わせ
|
ユーザー |
![]() |
提出日時 | 2016-07-08 23:20:18 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 485 bytes |
コンパイル時間 | 691 ms |
コンパイル使用メモリ | 6,784 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-10-13 06:51:29 |
合計ジャッジ時間 | 3,950 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 1 TLE * 1 -- * 94 |
ソースコード
def modpow(s,q,mod): ret = 1 while q > 0: if q % 2 == 1: ret = (s * ret) % mod s = (s * s) % mod q = q/2 return ret x = input() a = map(int,raw_input().split()) for i in xrange(len(a)): x = x - a[i] + 1 if x < len(a)+len(a)-1: print "NA" else: b = len(a)+1 c = x-len(a)-len(a)+1 d = 1 for i in xrange(b,b+c): d *= i d %= 1000000007 for i in xrange(1,c+1): d *= modpow(i,1000000005,1000000007) d %= 1000000007 print d