結果

問題 No.1224 I hate Sqrt Inequality
ユーザー こまるこまる
提出日時 2020-11-20 16:04:19
言語 Haskell
(9.8.2)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 8,299 ms
コンパイル使用メモリ 165,780 KB
実行使用メモリ 7,304 KB
最終ジャッジ日時 2023-09-30 18:28:12
合計ジャッジ時間 9,642 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,080 KB
testcase_01 AC 3 ms
7,032 KB
testcase_02 AC 3 ms
7,068 KB
testcase_03 AC 3 ms
7,244 KB
testcase_04 AC 3 ms
7,252 KB
testcase_05 AC 3 ms
7,236 KB
testcase_06 AC 3 ms
7,304 KB
testcase_07 AC 3 ms
7,248 KB
testcase_08 AC 3 ms
7,260 KB
testcase_09 AC 3 ms
7,232 KB
testcase_10 AC 2 ms
7,160 KB
testcase_11 AC 2 ms
7,288 KB
testcase_12 AC 2 ms
7,156 KB
testcase_13 AC 2 ms
7,164 KB
testcase_14 AC 3 ms
7,184 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import           Control.Monad
import           Control.Monad.Fix
import           Data.Bool
import           Data.IORef

main :: IO ()
main = do
  [a, b] <- map (read :: String -> Int) . words <$> getLine
  refB <- newIORef b
  modifyIORef' refB (`div` gcd a b)
  fix $ \loop -> do
    b1 <- readIORef refB
    when (even b1) $ modifyIORef' refB (`div` 2) >> loop
  fix $ \loop -> do
    b2 <- readIORef refB
    when (b2 `mod` 5 == 0) $ modifyIORef' refB (`div` 5) >> loop
  b3 <- readIORef refB
  putStrLn $ bool "No" "Yes" (b3 > 1)
0