Comment detail

税込み価格への修正 (Nested Flatten)
UTF-8の入力で確認。 他では文字化けするかもしれません。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import Char
includeTax s = inText s
    where inText []                    = []
          inText (x:xs) | isDigit x    = inPrice xs [x]
                        | otherwise    = x : inText xs
          inPrice (x:xs) y | isDigit x = inPrice xs (y ++ [x])
          inPrice xs y                 = tax y ++ inText xs
          tax s                        = show $ floor $ 1.05 * read s

main = getContents >>= (putStr . includeTax)

Index

Feed

Other

Link

Pathtraq

loading...