結果

問題 No.312 置換処理
ユーザー ducktail
提出日時 2018-05-08 12:28:50
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 224 bytes
コンパイル時間 4,783 ms
コンパイル使用メモリ 173,420 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 02:26:47
合計ジャッジ時間 2,954 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 39 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Applicative ((<$>))
import Data.List (find)

main :: IO ()
main = solve <$> read <$> getLine >>= print

solve :: Int -> Int
solve n = maybe n id . find ((== 0) . (mod n)) . takeWhile ((<= n) . (^ 2)) $ [3 ..]
0