結果

問題 No.25 有限小数
ユーザー Ysmr_RyYsmr_Ry
提出日時 2014-11-29 16:14:19
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 368 bytes
コンパイル時間 648 ms
コンパイル使用メモリ 158,712 KB
実行使用メモリ 7,596 KB
最終ジャッジ日時 2023-09-02 00:54:42
合計ジャッジ時間 2,079 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,396 KB
testcase_01 AC 2 ms
7,096 KB
testcase_02 AC 3 ms
7,132 KB
testcase_03 AC 3 ms
7,428 KB
testcase_04 AC 2 ms
7,548 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 3 ms
7,392 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 3 ms
7,356 KB
testcase_13 WA -
testcase_14 AC 3 ms
7,504 KB
testcase_15 WA -
testcase_16 AC 2 ms
7,392 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
7,076 KB
testcase_21 AC 2 ms
7,112 KB
testcase_22 WA -
testcase_23 AC 3 ms
7,388 KB
testcase_24 AC 2 ms
7,440 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

main :: IO ()
main = do
  n <- readLn :: IO Integer
  m <- readLn :: IO Integer

  putStrLn $ if m `mod` 2 /= 0 && m `mod` 5 /= 0
    then "-1"
    else [head $ dropWhile (\c -> c=='0'||c=='.') $ dropExp $ reverse $ show $ fromIntegral n/fromIntegral m]

dropExp :: String -> String
dropExp s
  | 'e' `elem` s = tail $ dropWhile (/='e') s
  | otherwise = s
0