結果

問題 No.939 and or
ユーザー LeonardoneLeonardone
提出日時 2019-12-02 01:37:20
言語 Haskell
(9.10.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 379 bytes
コンパイル時間 4,435 ms
コンパイル使用メモリ 173,696 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 02:07:39
合計ジャッジ時間 5,699 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

-- Try yukicoder
-- author: Leonardone @ NEETSDKASU


main = interact $ show . solve . map read . words
 
solve [a, b] = f True 1 a b

f ex cnt 0 0 = if ex then max 1 (div cnt 2) else 0
f ex cnt a b = f e c ad bd
    where
        (ad, am) = divMod a 2
        (bd, bm) = divMod b 2
        e = ex && not (am == 1 && bm == 0)
        c = cnt * if am == 0 && bm == 1 then 2 else 1
0