結果

問題 No.784 「,(カンマ)」
ユーザー chike_pluschike_plus
提出日時 2019-03-08 09:09:35
言語 F#
(F# 4.0)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 3,547 ms
コンパイル使用メモリ 162,140 KB
実行使用メモリ 24,784 KB
最終ジャッジ日時 2023-09-05 19:33:20
合計ジャッジ時間 5,372 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
24,552 KB
testcase_01 AC 78 ms
22,600 KB
testcase_02 AC 77 ms
22,600 KB
testcase_03 AC 77 ms
22,584 KB
testcase_04 AC 78 ms
22,576 KB
testcase_05 AC 77 ms
22,688 KB
testcase_06 AC 77 ms
22,744 KB
testcase_07 AC 79 ms
22,756 KB
testcase_08 AC 79 ms
22,632 KB
testcase_09 AC 79 ms
22,584 KB
testcase_10 AC 79 ms
24,784 KB
testcase_11 AC 78 ms
24,632 KB
testcase_12 AC 79 ms
22,520 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(9,13): warning FS0020: The result of this expression has type 'StringBuilder' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

/home/judge/data/code/Main.fs(10,13): warning FS0020: The result of this expression has type 'StringBuilder' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

/home/judge/data/code/Main.fs(11,13): warning FS0020: The result of this expression has type 'StringBuilder' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

/home/judge/data/code/Main.fs(12,13): warning FS0020: The result of this expression has type 'StringBuilder' and is implicitly ignored. Consider using 'ignore' to discard this value explicitly, e.g. 'expr |> ignore', or 'let' to bind the result to a name, e.g. 'let result = expr'.

ソースコード

diff #

open System
open System.Text

let separateStr (arg:string) =
  let rec splitStr (acc:StringBuilder) (argStr:StringBuilder) =
    match argStr.Length with
    | 0 -> ""
    | 1 | 2 | 3 -> argStr.ToString() + acc.ToString()
    | _ ->  acc.Insert(0, argStr.Chars (argStr.Length-1) )
            acc.Insert(0, argStr.Chars (argStr.Length-2) )
            acc.Insert(0, argStr.Chars (argStr.Length-3) )
            acc.Insert(0, ',' )
            argStr.Length <- argStr.Length-3
            splitStr  acc argStr 
             
  splitStr (new StringBuilder()) (new StringBuilder(arg))
  
Console.ReadLine() 
|> separateStr  
|> printfn "%s"
0