結果

問題 No.939 and or
ユーザー Leonardone
提出日時 2019-12-02 01:29:54
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 403 bytes
コンパイル時間 1,812 ms
コンパイル使用メモリ 174,720 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-22 01:56:16
合計ジャッジ時間 2,709 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 :: [Integer] -> Integer
solve [a, b] = f True 1 a b `div` 2

f ex cnt 0 0 = if ex then cnt 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