結果

問題 No.722 100×100=1000
ユーザー gemmaro
提出日時 2020-01-06 11:54:26
言語 Haskell
(9.10.1)
結果
RE  
実行時間 -
コード長 509 bytes
コンパイル時間 11,014 ms
コンパイル使用メモリ 173,824 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-22 23:56:48
合計ジャッジ時間 3,339 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

main = do
    [a, b] <- map read . words <$> getLine
    putStrLn $ solve a b

solve :: Int -> Int -> String
solve a b =
    let max = 99999999
        prod = a * b
        manyZeros = a `mod` 100 == 0 && b `mod` 100 == 0
        mental = manyZeros && simple a && simple b
        in
    if mental
       then init $ show prod
       else if abs prod <= max then show prod else "E"

simple :: Int -> Bool
simple n = (abs $ read nonZero) <= 9
    where nonZero = reverse $ dropWhile (== '0') $ reverse $ show n
0