結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,524 KB
testcase_01 AC 22 ms
8,640 KB
testcase_02 AC 19 ms
8,644 KB
testcase_03 AC 19 ms
8,636 KB
testcase_04 AC 19 ms
8,644 KB
testcase_05 AC 19 ms
8,652 KB
testcase_06 AC 20 ms
8,644 KB
testcase_07 AC 19 ms
8,656 KB
testcase_08 AC 20 ms
8,664 KB
testcase_09 AC 19 ms
8,660 KB
testcase_10 AC 19 ms
8,592 KB
testcase_11 AC 19 ms
8,656 KB
testcase_12 AC 19 ms
8,604 KB
testcase_13 AC 19 ms
8,668 KB
testcase_14 AC 19 ms
8,636 KB
testcase_15 AC 19 ms
8,640 KB
testcase_16 AC 19 ms
8,596 KB
testcase_17 AC 19 ms
8,604 KB
testcase_18 AC 19 ms
8,620 KB
testcase_19 AC 20 ms
8,664 KB
testcase_20 AC 20 ms
8,600 KB
testcase_21 AC 20 ms
8,600 KB
testcase_22 AC 20 ms
8,576 KB
testcase_23 AC 24 ms
8,660 KB
testcase_24 AC 28 ms
8,556 KB
testcase_25 AC 33 ms
8,600 KB
testcase_26 AC 63 ms
8,660 KB
testcase_27 AC 74 ms
8,572 KB
testcase_28 AC 89 ms
8,528 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