結果

問題 No.729 文字swap
ユーザー tak
提出日時 2018-09-09 12:15:25
言語 F#
(F# 4.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 16,906 ms
コンパイル使用メモリ 185,352 KB
実行使用メモリ 29,056 KB
最終ジャッジ日時 2024-12-23 03:04:59
合計ジャッジ時間 18,624 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (493 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

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