結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー | くれちー |
提出日時 | 2017-02-04 01:24:08 |
言語 | Haskell (9.6.2) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 792 bytes |
コンパイル時間 | 2,289 ms |
コンパイル使用メモリ | 159,556 KB |
実行使用メモリ | 11,208 KB |
最終ジャッジ日時 | 2023-08-25 20:02:34 |
合計ジャッジ時間 | 2,692 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
7,164 KB |
testcase_01 | AC | 2 ms
7,068 KB |
testcase_02 | AC | 3 ms
6,968 KB |
testcase_03 | AC | 2 ms
7,044 KB |
testcase_04 | AC | 3 ms
7,064 KB |
testcase_05 | AC | 7 ms
11,208 KB |
testcase_06 | AC | 7 ms
11,184 KB |
testcase_07 | AC | 4 ms
9,120 KB |
testcase_08 | AC | 5 ms
10,008 KB |
testcase_09 | AC | 6 ms
10,080 KB |
testcase_10 | AC | 2 ms
7,360 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
ソースコード
import Numeric import Data.Char import Control.Monad intToChar :: Int -> Char intToChar x | 0 <= x && x <= 9 = chr $ ord '0' + x | 10 <= x && x <= 35 = chr $ ord 'A' - 10 + x charToInt :: Char -> Int charToInt c | '0' <= c && c <= '9' = ord c - ord '0' | 'A' <= c && c <= 'Z' = ord c - ord 'A' + 10 toDecimal :: Integral a => Int -> String -> a toDecimal fr fx = sum $ zipWith (\a b -> a * fr' ^ b) fx' $ reverse [0..length fx' - 1] where fx' = dropWhile (== 0) $ map (fromIntegral . charToInt) fx fr' = fromIntegral fr solve :: Integral a => [String] -> a solve xs = minimum $ zipWith toDecimal minrs xs where minrs = map ((+ 1) . charToInt . maximum) xs main = do n <- readLn vs <- replicateM n getLine print $ solve vs