結果
問題 |
No.1010 折って重ねて
|
ユーザー |
![]() |
提出日時 | 2020-05-03 14:54:27 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 361 ms / 2,000 ms |
コード長 | 902 bytes |
コンパイル時間 | 15,667 ms |
コンパイル使用メモリ | 199,268 KB |
実行使用メモリ | 37,284 KB |
最終ジャッジ日時 | 2024-06-12 04:16:12 |
合計ジャッジ時間 | 33,989 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (347 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) /home/judge/data/code/Main.fs(7,9): 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/
ソースコード
// Learn more about F# at http://fsharp.org open System [<EntryPoint>] let main argv = let [| xx; yy; h |] = stdin.ReadLine().Split() |> Array.map float let x, y = Math.Min(xx, yy), Math.Max(xx, yy) let ans = seq { for a in 0 .. 20 do // x を a 回折れるか // x / 2^(a - 1) > h * 2^(a - 1) let p2 = Math.Pow(2.0, float (a) - 1.0) if a = 0 || x * 1000.0 / p2 > h * p2 then for b in 0 .. 20 do let q2 = Math.Pow(2.0, float (b) - 1.0) if b = 0 || y * 1000.0 / q2 > h * Math.Pow(2.0, float (a)) * q2 then yield (a, b) } |> Seq.map (fun tup -> (fst tup) + (snd tup)) |> Seq.max printfn "%d" ans 0 // return an integer exit code