結果

問題 No.722 100×100=1000
ユーザー ichibanshibori
提出日時 2018-09-08 18:57:27
言語 F#
(F# 4.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 709 bytes
コンパイル時間 13,871 ms
コンパイル使用メモリ 187,548 KB
実行使用メモリ 31,104 KB
最終ジャッジ日時 2024-12-29 19:37:15
合計ジャッジ時間 18,119 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (375 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 #

open System

let isIt x =
    let rec isIt' (x' : int) =
        if Math.Abs(x') < 10 then true
        elif x' % 10 <> 0 then false
        else isIt' (x' / 10)

    if x % 100 <> 0 then false
    else isIt' x

let solve a b =
    if isIt a && isIt b then
        Some(decimal a * decimal b / 10m)
    else
        let ab = decimal a * decimal b
        if Math.Abs(ab) > 99999999m then
            None
        else
            Some(ab)

let () =
    let a, b =
        Console.ReadLine()
        |> fun s -> s.Split()
        |> fun abArr -> int abArr.[0], int abArr.[1]
    
    let result =
        match solve a b with
        | Some(x) -> sprintf "%.0M" x
        | None -> "E"

    printfn "%s" result
0