結果

問題 No.1102 Remnants
ユーザー eSeFeSeF
提出日時 2020-07-03 16:06:06
言語 F#
(F# 4.0)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 990 bytes
コンパイル時間 5,574 ms
コンパイル使用メモリ 165,292 KB
実行使用メモリ 58,560 KB
最終ジャッジ日時 2023-10-14 23:36:17
合計ジャッジ時間 14,691 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
24,464 KB
testcase_01 AC 67 ms
24,472 KB
testcase_02 AC 66 ms
22,468 KB
testcase_03 AC 66 ms
22,416 KB
testcase_04 AC 67 ms
22,496 KB
testcase_05 AC 431 ms
53,200 KB
testcase_06 AC 134 ms
30,916 KB
testcase_07 AC 541 ms
58,560 KB
testcase_08 AC 80 ms
22,728 KB
testcase_09 AC 93 ms
25,432 KB
testcase_10 AC 75 ms
22,656 KB
testcase_11 AC 84 ms
23,236 KB
testcase_12 AC 93 ms
25,364 KB
testcase_13 AC 89 ms
23,316 KB
testcase_14 AC 273 ms
45,672 KB
testcase_15 AC 223 ms
38,272 KB
testcase_16 AC 495 ms
56,748 KB
testcase_17 AC 456 ms
49,184 KB
testcase_18 AC 468 ms
53,068 KB
testcase_19 AC 205 ms
39,848 KB
testcase_20 AC 110 ms
28,164 KB
testcase_21 AC 325 ms
49,500 KB
testcase_22 AC 412 ms
49,936 KB
testcase_23 AC 332 ms
53,468 KB
testcase_24 AC 265 ms
49,432 KB
testcase_25 AC 488 ms
53,388 KB
testcase_26 AC 94 ms
23,456 KB
testcase_27 AC 170 ms
35,536 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System
let R T = stdin.ReadLine()|> T
let RS T = stdin.ReadLine().Split()|>Array.map T
let R2 T U = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U)
let R3 T U V = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V)
let R4 T U V W = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V),(c.[3]|>W)
let R5 T U V W X = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V),(c.[3]|>W),(c.[4]|>X)
[<EntryPoint>]
let main argv =
    let N,K = R2 int int64
    let A = RS int64
    let MOD = 1000000007L
    let rec modpow (x:int64) n =
        match n with
        | 0 -> 1L
        | 1 -> x%MOD
        | _ when n%2=0 -> ((modpow ((x*x)%MOD) (n/2)))%MOD
        | _ -> (x*(modpow x (n-1)))%MOD
    let comb = [|for i in [1..N] do yield 1L|]
    for i in [1..(N-1)] do
        comb.[i] <- ((comb.[i-1]*(K+(i|>int64)))%MOD*(modpow (i|>int64) 1000000005))%MOD
    [for i in [0..(N-1)] do yield ((comb.[i]*comb.[N-1-i])%MOD*A.[i])%MOD]
    |>List.reduce (fun a b -> (a+b)%MOD)
    |>stdout.WriteLine
    0
0