結果

問題 No.293 4>7の世界
ユーザー nobigomunobigomu
提出日時 2018-06-01 13:29:05
言語 F#
(F# 4.0)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 4,036 ms
コンパイル使用メモリ 157,624 KB
実行使用メモリ 25,032 KB
最終ジャッジ日時 2023-08-28 22:25:30
合計ジャッジ時間 7,290 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
20,548 KB
testcase_01 AC 77 ms
22,608 KB
testcase_02 AC 77 ms
24,636 KB
testcase_03 AC 85 ms
24,952 KB
testcase_04 AC 83 ms
22,956 KB
testcase_05 AC 81 ms
24,944 KB
testcase_06 AC 76 ms
22,528 KB
testcase_07 AC 82 ms
23,048 KB
testcase_08 AC 84 ms
24,936 KB
testcase_09 AC 85 ms
22,924 KB
testcase_10 AC 78 ms
22,684 KB
testcase_11 AC 86 ms
22,964 KB
testcase_12 AC 84 ms
22,980 KB
testcase_13 AC 84 ms
22,916 KB
testcase_14 AC 83 ms
23,156 KB
testcase_15 AC 84 ms
21,012 KB
testcase_16 AC 78 ms
24,756 KB
testcase_17 AC 85 ms
22,972 KB
testcase_18 AC 85 ms
22,900 KB
testcase_19 AC 84 ms
24,984 KB
testcase_20 AC 77 ms
22,612 KB
testcase_21 AC 75 ms
22,544 KB
testcase_22 AC 86 ms
22,968 KB
testcase_23 AC 87 ms
25,032 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let g a b = Seq.zip a b |> Seq.tryFindIndex (fun (a,b) -> a<>b) |> Option.get
let f (s:string) (t:string) =
    if s.Length<>t.Length then
        s.Length>t.Length
    else
        let i = g s t
        match (s.[i],t.[i]) with
        | ('7','4') | ('4','7') -> not (s.[i]>t.[i])
        | _ -> s.[i]>t.[i]
    |> fun b -> if b then s else t

(stdin.ReadLine >> fun s -> s.Split ' ') () |> fun a -> f a.[0] a.[1] |> printfn "%s"
0