結果

問題 No.1020 Reverse
ユーザー iwotiwot
提出日時 2020-06-19 23:12:11
言語 F#
(F# 4.0)
結果
AC  
実行時間 241 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 5,280 ms
コンパイル使用メモリ 163,272 KB
実行使用メモリ 38,584 KB
最終ジャッジ日時 2023-09-16 15:20:07
合計ジャッジ時間 8,741 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
24,756 KB
testcase_01 AC 80 ms
22,736 KB
testcase_02 AC 84 ms
22,796 KB
testcase_03 AC 85 ms
22,804 KB
testcase_04 AC 81 ms
22,732 KB
testcase_05 AC 80 ms
20,752 KB
testcase_06 AC 86 ms
22,852 KB
testcase_07 AC 115 ms
23,888 KB
testcase_08 AC 84 ms
25,644 KB
testcase_09 AC 83 ms
23,552 KB
testcase_10 AC 132 ms
26,448 KB
testcase_11 AC 172 ms
35,940 KB
testcase_12 AC 84 ms
23,780 KB
testcase_13 AC 84 ms
21,732 KB
testcase_14 AC 182 ms
38,584 KB
testcase_15 AC 238 ms
34,936 KB
testcase_16 AC 241 ms
37,120 KB
testcase_17 AC 84 ms
23,768 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

/home/judge/data/code/Main.fs(1,5): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _|]' may indicate a case not covered by the pattern(s).

ソースコード

diff #

let [| N; K |] = stdin.ReadLine().Split(' ') |> Array.map int
let S = stdin.ReadLine().Trim()

let solve n k (s:string) =
    if (n - k) % 2 <> 0 then
        s.[k-1 .. ] + s.[ .. k-2]
    else
        s.[k-1 .. ] + (s.[ .. k-2] |> Seq.toList |> Seq.rev |> System.String.Concat)

printfn "%s" <| solve N K S
0