結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
![]() |
提出日時 | 2017-03-11 21:23:12 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 41 ms / 1,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 6,267 ms |
コンパイル使用メモリ | 170,956 KB |
実行使用メモリ | 14,848 KB |
最終ジャッジ日時 | 2024-10-01 08:32:06 |
合計ジャッジ時間 | 13,067 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 103 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
palindrome :: Int -> [Int] palindrome d = map (foldr (\x acc -> x + acc * 10) 0) $ palindrome' d 1 where palindrome' 1 i = [ [x] | x <- [i..9] ] palindrome' 2 i = [ [x, x] | x <- [i..9] ] palindrome' d i = [ x : (l ++ [x]) | x <- [i..9], l <- palindrome' (d-2) 0 ] pa = concat (map palindrome [1..9]) main = do n <- readLn print $ length $ filter (\m -> m * (10 ^ 9 + 1) <= n) pa