結果

問題 No.722 100×100=1000
ユーザー gemmaro
提出日時 2020-01-06 11:58:37
言語 Haskell
(9.10.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 541 bytes
コンパイル時間 4,092 ms
コンパイル使用メモリ 174,720 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 19:49:38
合計ジャッジ時間 5,196 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 0 _ = "0"
solve _ 0 = "0"
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