結果

問題 No.660 家を通り過ぎないランダムウォーク問題
ユーザー Yuu EguciYuu Eguci
提出日時 2018-06-25 17:52:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 515 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 10,832 KB
実行使用メモリ 13,200 KB
最終ジャッジ日時 2023-09-13 13:52:59
合計ジャッジ時間 10,658 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
12,980 KB
testcase_01 AC 20 ms
8,668 KB
testcase_02 AC 20 ms
8,604 KB
testcase_03 AC 20 ms
8,596 KB
testcase_04 AC 20 ms
8,672 KB
testcase_05 AC 20 ms
8,692 KB
testcase_06 AC 20 ms
8,604 KB
testcase_07 AC 20 ms
8,672 KB
testcase_08 AC 20 ms
8,624 KB
testcase_09 AC 20 ms
8,736 KB
testcase_10 AC 20 ms
8,760 KB
testcase_11 AC 20 ms
8,620 KB
testcase_12 AC 20 ms
8,724 KB
testcase_13 AC 20 ms
8,668 KB
testcase_14 AC 20 ms
8,628 KB
testcase_15 AC 20 ms
8,680 KB
testcase_16 AC 20 ms
8,628 KB
testcase_17 AC 20 ms
8,692 KB
testcase_18 AC 20 ms
8,668 KB
testcase_19 AC 19 ms
8,652 KB
testcase_20 AC 20 ms
8,660 KB
testcase_21 AC 20 ms
8,672 KB
testcase_22 AC 21 ms
8,608 KB
testcase_23 AC 25 ms
8,656 KB
testcase_24 AC 29 ms
8,772 KB
testcase_25 AC 34 ms
8,760 KB
testcase_26 AC 64 ms
8,680 KB
testcase_27 AC 73 ms
8,604 KB
testcase_28 AC 89 ms
8,604 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
権限があれば一括ダウンロードができます

ソースコード

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

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

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