結果

問題 No.273 回文分解
ユーザー vain0vain0
提出日時 2015-08-28 22:44:14
言語 F#
(.NET 7)
結果
WA  
実行時間 -
コード長 594 bytes
コンパイル時間 5,745 ms
コンパイル使用メモリ 165,776 KB
実行使用メモリ 24,992 KB
最終ジャッジ日時 2023-08-25 00:09:10
合計ジャッジ時間 10,410 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
24,864 KB
testcase_01 AC 89 ms
22,912 KB
testcase_02 AC 88 ms
22,964 KB
testcase_03 AC 85 ms
22,832 KB
testcase_04 AC 86 ms
24,928 KB
testcase_05 AC 87 ms
22,824 KB
testcase_06 AC 84 ms
22,876 KB
testcase_07 AC 85 ms
22,948 KB
testcase_08 AC 89 ms
22,804 KB
testcase_09 AC 86 ms
22,872 KB
testcase_10 AC 90 ms
22,828 KB
testcase_11 AC 87 ms
24,936 KB
testcase_12 AC 87 ms
22,816 KB
testcase_13 AC 89 ms
22,824 KB
testcase_14 AC 90 ms
22,868 KB
testcase_15 AC 89 ms
22,792 KB
testcase_16 AC 89 ms
24,808 KB
testcase_17 AC 87 ms
24,868 KB
testcase_18 WA -
testcase_19 AC 89 ms
22,888 KB
testcase_20 AC 89 ms
24,828 KB
testcase_21 AC 89 ms
22,896 KB
testcase_22 AC 87 ms
24,916 KB
testcase_23 WA -
testcase_24 AC 89 ms
22,920 KB
testcase_25 AC 90 ms
24,916 KB
testcase_26 AC 88 ms
22,824 KB
testcase_27 AC 91 ms
24,940 KB
testcase_28 AC 89 ms
22,868 KB
testcase_29 AC 88 ms
22,924 KB
testcase_30 AC 89 ms
20,772 KB
testcase_31 WA -
testcase_32 AC 90 ms
24,836 KB
testcase_33 AC 89 ms
22,872 KB
testcase_34 AC 88 ms
22,872 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System
open System.Text

let solve s =
    let len = s |> String.length
    
    let lengest_palin k =
        let rec loop i j l =
            if 0 <= i && i < len && 0 <= j && j < len
                && s.[i] = s.[j]
            then loop (i - 1) (j + 1) (l + 2)
            else l
        [ loop (k - 1) (k + 1) 1; loop k (k + 1) 0 ]

    [ for k in 0..((s |> String.length) - 1) do
        yield! lengest_palin k
        ]
    |> List.filter ((<>) len)
    |> List.fold max 1

[<EntryPoint>]
let main argv =
    let s = Console.ReadLine()
    printfn "%d" <| solve s

    //exit
    0
0