結果

問題 No.219 巨大数の概算
ユーザー くれちーくれちー
提出日時 2017-02-09 14:57:01
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 1,301 ms
コンパイル使用メモリ 161,216 KB
実行使用メモリ 11,428 KB
最終ジャッジ日時 2023-08-26 22:35:35
合計ジャッジ時間 9,571 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
11,300 KB
testcase_01 AC 63 ms
11,428 KB
testcase_02 AC 61 ms
11,208 KB
testcase_03 AC 62 ms
11,264 KB
testcase_04 AC 62 ms
11,256 KB
testcase_05 AC 2 ms
7,200 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 3 ms
7,120 KB
testcase_10 AC 63 ms
11,196 KB
testcase_11 AC 62 ms
11,260 KB
testcase_12 AC 62 ms
11,304 KB
testcase_13 AC 62 ms
11,200 KB
testcase_14 AC 63 ms
11,268 KB
testcase_15 AC 63 ms
11,208 KB
testcase_16 AC 62 ms
11,212 KB
testcase_17 AC 62 ms
11,256 KB
testcase_18 AC 63 ms
11,192 KB
testcase_19 AC 62 ms
11,256 KB
testcase_20 AC 62 ms
11,200 KB
testcase_21 AC 62 ms
11,252 KB
testcase_22 WA -
testcase_23 AC 62 ms
11,200 KB
testcase_24 AC 62 ms
11,272 KB
testcase_25 AC 62 ms
11,256 KB
testcase_26 AC 62 ms
11,200 KB
testcase_27 AC 62 ms
11,268 KB
testcase_28 AC 62 ms
11,256 KB
testcase_29 AC 62 ms
11,304 KB
testcase_30 AC 62 ms
11,268 KB
testcase_31 AC 61 ms
11,188 KB
testcase_32 AC 62 ms
11,260 KB
testcase_33 AC 62 ms
11,316 KB
testcase_34 AC 62 ms
11,196 KB
testcase_35 AC 63 ms
11,248 KB
testcase_36 AC 62 ms
11,196 KB
testcase_37 AC 63 ms
11,276 KB
testcase_38 AC 62 ms
11,216 KB
testcase_39 AC 62 ms
11,260 KB
testcase_40 AC 62 ms
11,264 KB
testcase_41 AC 62 ms
11,260 KB
testcase_42 AC 62 ms
11,272 KB
testcase_43 AC 62 ms
11,208 KB
testcase_44 AC 62 ms
11,256 KB
testcase_45 AC 62 ms
11,184 KB
testcase_46 AC 62 ms
11,260 KB
testcase_47 AC 62 ms
11,248 KB
testcase_48 AC 62 ms
11,212 KB
testcase_49 AC 62 ms
11,244 KB
testcase_50 AC 62 ms
11,264 KB
testcase_51 AC 3 ms
6,996 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 (forM_)
import Control.Applicative ((<$>))

first :: (a, b, c) -> a
first (x, _, _) = x

second :: (a, b, c) -> b
second (_, x, _) = x

third :: (a, b, c) -> c
third (_, _, x) = x

log10 :: Floating a => a -> a
log10 = logBase 10.0

solve :: Integral a => a -> a -> (a, a, a)
solve a b = (x, y, z)
    where
        a' = fromIntegral a
        b' = fromIntegral b
        t1 = b' * log10 a'
        t2 = 10.0 ** (snd . properFraction $ t1)
        x  = floor t2
        y  = floor (t2 * 10) `mod` 10
        z  = ceiling t1 - 1

main = do
    n <- readLn
    forM_ [1..n] $ \_ -> do
        [a, b] <- map read . words <$> getLine
        let ans = solve a b
        let x = first ans; y = second ans; z = third ans
        putStrLn $ show x ++ " " ++ show y ++ " " ++ show z
0