結果
問題 |
No.164 ちっちゃくないよ!!
|
ユーザー |
|
提出日時 | 2016-05-12 13:19:01 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 71 ms / 2,000 ms |
コード長 | 673 bytes |
コンパイル時間 | 4,166 ms |
コンパイル使用メモリ | 172,544 KB |
実行使用メモリ | 26,112 KB |
最終ジャッジ日時 | 2024-10-14 13:30:55 |
合計ジャッジ時間 | 3,581 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
コンパイルメッセージ
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:5:1: warning: [GHC-94817] [-Wtabs] Tab character found here, and in four further locations. Suggested fix: Please use spaces instead. | 5 | where r = map (\x -> if x >= b then Nothing else Just x) (reverse n) | ^^^^^^^^ [2 of 2] Linking a.out
ソースコード
import Data.Char base :: [Integer] -> Integer -> Maybe Integer base n b = fmap sum $ sequence $ zipWith fmap (map (*) (iterate (* b) 1)) r where r = map (\x -> if x >= b then Nothing else Just x) (reverse n) minM' :: Maybe Integer -> Maybe Integer -> Maybe Integer minM' a Nothing = a minM' Nothing b = b minM' a b = fmap minimum (sequence [a, b]) minM :: [Maybe Integer] -> Maybe Integer minM [] = Nothing minM (x:xs) = minM' x (minM xs) main = do getLine nums <- getContents >>= return . map (map (\c -> if isDigit c then ord c - 48 else ord c - 65 + 10)) . lines let Just m = minM [base (map fromIntegral n) (fromIntegral b) | n <- nums, b <- [2..36]] print $ m