結果

問題 No.784 「,(カンマ)」
ユーザー chike_pluschike_plus
提出日時 2019-03-08 19:33:56
言語 F#
(F# 4.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 3,430 ms
コンパイル使用メモリ 161,852 KB
実行使用メモリ 25,448 KB
最終ジャッジ日時 2023-09-05 19:41:56
合計ジャッジ時間 4,931 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
21,320 KB
testcase_01 AC 54 ms
23,460 KB
testcase_02 AC 53 ms
21,424 KB
testcase_03 AC 53 ms
21,420 KB
testcase_04 AC 53 ms
21,308 KB
testcase_05 AC 53 ms
21,408 KB
testcase_06 AC 52 ms
21,396 KB
testcase_07 AC 53 ms
19,592 KB
testcase_08 AC 54 ms
21,552 KB
testcase_09 AC 53 ms
21,548 KB
testcase_10 AC 55 ms
25,448 KB
testcase_11 AC 53 ms
21,416 KB
testcase_12 AC 53 ms
21,432 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(10,9): 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,9): 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,9): 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(13,9): 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) =
  
    if argStr.Length <= 3
    then argStr.ToString() + acc.ToString()
    else
        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  
|> Console.WriteLine
0