結果

問題 No.327 アルファベット列
ユーザー くれちー
提出日時 2016-12-31 00:32:24
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 174,080 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-16 04:19:22
合計ジャッジ時間 3,174 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 44
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

import Control.Monad

rconv :: Integral a => a -> Bool -> [a]
rconv n f
    |     f && n < 26 = [n]
    | not f && n < 27 = [pred n]
    |     f           = rconv (n `div` 26) False ++ [n `mod` 26]
    | not f           = rconv (n `div` 27) False ++ [n `mod` 27]

cconv :: Integral a => a -> Char -> Char
cconv 0 c = c
cconv n c = cconv (pred n) (succ c)

solve :: Integral a => a -> [Char]
solve n = [cconv t 'A' | t <- rconv n True]

main = do
    n <- readLn
    putStrLn $ solve n
0