結果

問題 No.442 和と積
ユーザー taktak
提出日時 2018-05-26 03:30:22
言語 F#
(F# 4.0)
結果
AC  
実行時間 83 ms / 1,000 ms
コード長 382 bytes
コンパイル時間 4,853 ms
コンパイル使用メモリ 160,080 KB
実行使用メモリ 24,924 KB
最終ジャッジ日時 2023-09-18 07:01:47
合計ジャッジ時間 7,491 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
22,848 KB
testcase_01 AC 82 ms
24,924 KB
testcase_02 AC 81 ms
24,864 KB
testcase_03 AC 82 ms
22,752 KB
testcase_04 AC 81 ms
20,812 KB
testcase_05 AC 82 ms
22,924 KB
testcase_06 AC 82 ms
24,880 KB
testcase_07 AC 83 ms
22,748 KB
testcase_08 AC 83 ms
24,844 KB
testcase_09 AC 82 ms
20,856 KB
testcase_10 AC 81 ms
22,820 KB
testcase_11 AC 81 ms
22,884 KB
testcase_12 AC 82 ms
20,872 KB
testcase_13 AC 82 ms
24,844 KB
testcase_14 AC 83 ms
22,792 KB
testcase_15 AC 82 ms
22,768 KB
testcase_16 AC 83 ms
22,864 KB
testcase_17 AC 81 ms
24,784 KB
testcase_18 AC 82 ms
24,892 KB
testcase_19 AC 81 ms
22,672 KB
testcase_20 AC 83 ms
24,792 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let R () = let t = stdin.ReadLine().Split()
                   |> Array.map int64
           t.[0], t.[1]
        
let rec gcd a b =  
    if a < b then 
        gcd b a
    else
        match b with
        | 0L -> a
        | b  -> gcd b (a % b)
    
    
let A, B = R ()

let G = 
    let g = gcd A B
    let a = A / g
    let b = B / g
    (gcd (a + b) g) * g

G |> printfn "%i"
0