結果

問題 No.428 小数から逃げる夢
ユーザー torus711
提出日時 2016-10-02 23:07:56
言語 Haskell
(9.10.1)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 889 bytes
コンパイル時間 9,423 ms
コンパイル使用メモリ 172,288 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-21 13:31:27
合計ジャッジ時間 7,725 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )

Main.hs:24:1: warning: [GHC-94817] [-Wtabs]
    Tab character found here, and in 18 further locations.
    Suggested fix: Please use spaces instead.
   |
24 |         n :: Integer <- readLn
   | ^^^^^^^^
[2 of 2] Linking a.out

ソースコード

diff #

{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

d = 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991

main = do
	n :: Integer <- readLn
	let
		dd = d * n
		s1 = show d
		s2 = show dd
		l1 = length s1
		l2 = length s2
		k = l2 - l1
	if k == 0
		then printf "0.%s\n" $ s2
		else printf "%s.%s\n" ( take k s2 ) ( drop k s2 )
0