結果
| 問題 | No.18 うーさー暗号 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-25 18:19:19 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 5,000 ms |
| コード長 | 286 bytes |
| コンパイル時間 | 7,127 ms |
| コンパイル使用メモリ | 170,112 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-01 08:29:30 |
| 合計ジャッジ時間 | 7,869 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
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
ソースコード
import Data.Char (ord)
chars = cycle ['A' .. 'Z']
encode = map (subtract (ord 'A') . ord)
decode = map (chars !!)
usa s = decode $ zipWith (\n c -> f (c - n)) [1 ..] $ encode s
where
f a
| a < 0 = (26 * 1024) + a
| otherwise = a
main = getLine >>= putStrLn . usa