結果

問題 No.293 4>7の世界
ユーザー nobigomu
提出日時 2018-06-01 13:29:05
言語 F#
(F# 4.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 430 bytes
コンパイル時間 16,654 ms
コンパイル使用メモリ 191,828 KB
実行使用メモリ 30,848 KB
最終ジャッジ日時 2024-12-30 12:39:53
合計ジャッジ時間 16,793 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (358 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 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