結果
| 問題 | No.312 置換処理 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-21 15:11:16 |
| 言語 | Haskell (9.10.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 671 bytes |
| 記録 | |
| コンパイル時間 | 2,050 ms |
| コンパイル使用メモリ | 174,592 KB |
| 実行使用メモリ | 8,064 KB |
| 最終ジャッジ日時 | 2024-07-20 05:02:42 |
| 合計ジャッジ時間 | 3,736 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 32 WA * 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 Control.Monad
import Debug.Trace
div2 :: Integer -> Integer
div2 en
| odd en == True = en
| otherwise = div2 $ div en 2
searchSosu :: Integer -> Integer -> Integer -> Integer
searchSosu pn rootn n
| pn > rootn = n
| modpn == 0 = pn
| otherwise = searchSosu (pn + 2) rootn n
where
modpn = n `mod` pn
main = do
n <- (read :: String -> Integer) <$> getLine
let
oddn = div2 n
n' | n == oddn = n
| oddn == 1 = n
| otherwise = oddn
floor_rootn = floor $ sqrt $ fromInteger (n'::Integer)
rootn_1 = floor_rootn + 1
print $ searchSosu 3 rootn_1 n'