結果

問題 No.729 文字swap
ユーザー taktak
提出日時 2018-09-09 12:15:25
言語 F#
(F# 4.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 6,170 ms
コンパイル使用メモリ 152,888 KB
実行使用メモリ 24,284 KB
最終ジャッジ日時 2023-08-24 18:28:38
合計ジャッジ時間 7,940 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
20,156 KB
testcase_01 AC 57 ms
24,240 KB
testcase_02 AC 57 ms
24,108 KB
testcase_03 AC 57 ms
22,216 KB
testcase_04 AC 57 ms
22,212 KB
testcase_05 AC 57 ms
20,032 KB
testcase_06 AC 56 ms
20,116 KB
testcase_07 AC 57 ms
22,132 KB
testcase_08 AC 57 ms
24,112 KB
testcase_09 AC 58 ms
22,168 KB
testcase_10 AC 58 ms
24,284 KB
testcase_11 AC 57 ms
22,156 KB
testcase_12 AC 57 ms
22,264 KB
testcase_13 AC 57 ms
22,172 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let R() = stdin.ReadLine()
let swapStr (str:string) a b = 
    let i = min a b 
    let j = max a b
    let l = str.Length
    str.[0 .. i-1] 
    + str.[j   ..   j] 
    + str.[i+1 .. j-1]
    + str.[i   .. i  ]
    + str.[j+1 .. l-1]


let str = R()
let i,j = let t = R().Split() |> Array.map int in t.[0], t.[1]

swapStr str i j |> stdout.WriteLine
0