結果
| 問題 |
No.293 4>7の世界
|
| コンテスト | |
| ユーザー |
vain0
|
| 提出日時 | 2015-10-24 00:02:57 |
| 言語 | F# (F# 4.0) |
| 結果 |
AC
|
| 実行時間 | 75 ms / 2,000 ms |
| コード長 | 717 bytes |
| コンパイル時間 | 15,334 ms |
| コンパイル使用メモリ | 198,920 KB |
| 実行使用メモリ | 30,464 KB |
| 最終ジャッジ日時 | 2024-12-30 11:20:01 |
| 合計ジャッジ時間 | 18,146 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (632 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) /home/judge/data/code/Main.fs(6,7): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj] main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
open System
open System.Collections.Generic
[<EntryPoint>]
let main argv =
let [| a; b |] = Console.ReadLine().Split(' ')
let result =
if a.Length <> b.Length then
if a.Length > b.Length
then a
else b
else
let rec mymax (x: string) (y: string) =
if x.Length = 0
then ""
else
let s, ss = x.[0], x.Substring(1)
let t, ts = y.[0], y.Substring(1)
match (s, t) with
| ('4', '7') -> x
| ('7', '4') -> y
| _ ->
if s <> t
then if s > t then x else y
else (string s) + mymax ss ts
mymax a b
printfn "%s" result
//exit code
0
vain0