結果

問題 No.660 家を通り過ぎないランダムウォーク問題
ユーザー AvalonalanAvalonalan
提出日時 2018-06-26 17:43:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 576 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 8,728 KB
最終ジャッジ日時 2023-09-13 14:10:48
合計ジャッジ時間 2,525 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
8,688 KB
testcase_01 AC 21 ms
8,676 KB
testcase_02 AC 20 ms
8,520 KB
testcase_03 AC 20 ms
8,628 KB
testcase_04 AC 19 ms
8,508 KB
testcase_05 AC 19 ms
8,624 KB
testcase_06 AC 19 ms
8,664 KB
testcase_07 AC 19 ms
8,696 KB
testcase_08 AC 20 ms
8,524 KB
testcase_09 AC 20 ms
8,616 KB
testcase_10 AC 20 ms
8,708 KB
testcase_11 AC 20 ms
8,652 KB
testcase_12 AC 19 ms
8,692 KB
testcase_13 AC 19 ms
8,648 KB
testcase_14 AC 19 ms
8,632 KB
testcase_15 AC 22 ms
8,668 KB
testcase_16 AC 20 ms
8,696 KB
testcase_17 AC 20 ms
8,696 KB
testcase_18 AC 19 ms
8,520 KB
testcase_19 AC 19 ms
8,700 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin, stdout
from operator import mul
from functools import reduce

NUM = 1000000007

def nCr(n,r):
  if r > 0:
    numer = reduce(mul,range(n-r+1,n+1))
    denom = reduce(mul,range(1,r+1))
    return numer//denom
  else:
    return 1

## 1 - n / m-n+1

def FindAllSolutions( N ):
  res = 1
  MAXLEFT = int(N/2)
  for i in range(1,MAXLEFT+1):
    total = N+2*i
    a = nCr(total-1,i)
    # b = nCr(total-1,i-1)
    a -= a*(i/(total-i))
    res += a
  stdout.write( "%d\n" % ( res % NUM ) )

if __name__ == '__main__':
  FindAllSolutions(int(stdin.readline()))
0