結果

問題 No.988 N×Mマス計算(総和)
ユーザー natoriusannatoriusan
提出日時 2023-08-01 17:34:24
言語 F#
(F# 4.0)
結果
AC  
実行時間 359 ms / 2,000 ms
コード長 491 bytes
コンパイル時間 8,164 ms
コンパイル使用メモリ 198,216 KB
実行使用メモリ 61,952 KB
最終ジャッジ日時 2024-04-19 16:47:41
合計ジャッジ時間 14,079 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 306 ms
35,236 KB
testcase_01 AC 309 ms
35,228 KB
testcase_02 AC 309 ms
34,988 KB
testcase_03 AC 311 ms
35,236 KB
testcase_04 AC 306 ms
35,208 KB
testcase_05 AC 311 ms
35,364 KB
testcase_06 AC 309 ms
35,240 KB
testcase_07 AC 307 ms
35,252 KB
testcase_08 AC 310 ms
35,372 KB
testcase_09 AC 306 ms
35,360 KB
testcase_10 AC 317 ms
41,232 KB
testcase_11 AC 330 ms
48,512 KB
testcase_12 AC 346 ms
52,864 KB
testcase_13 AC 320 ms
45,532 KB
testcase_14 AC 322 ms
45,184 KB
testcase_15 AC 327 ms
40,220 KB
testcase_16 AC 343 ms
49,536 KB
testcase_17 AC 348 ms
52,576 KB
testcase_18 AC 327 ms
47,872 KB
testcase_19 AC 341 ms
51,584 KB
testcase_20 AC 359 ms
61,952 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (258 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
/home/judge/data/code/Main.fs(1,5): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj]
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

let [|n; m; k|] = stdin.ReadLine().Split " " |> Array.map int64

let x = stdin.ReadLine().Split " "

let op = x.[0]
let b = x.[1..] |> Array.map int64
let a =
    [|
        for _ in 0..(n-1L |> int) ->
            stdin.ReadLine () |> int64
    |]
    
if op = "+" then
    let f a = Array.reduce (fun x y -> (x + y) % k) >> (fun x -> (x * a) % k)
    ((a |> f m) + (b |> f n)) % k
else
    let f = Array.reduce (fun x y -> (x + y) % k)
    ((a |> f) * (b |> f)) % (int64 k)
|> printfn "%d"
0