結果
| 問題 |
No.300 平方数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-17 00:05:55 |
| 言語 | Haskell (9.10.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 457 bytes |
| コンパイル時間 | 4,439 ms |
| コンパイル使用メモリ | 173,756 KB |
| 実行使用メモリ | 13,888 KB |
| 最終ジャッジ日時 | 2024-09-13 15:43:27 |
| 合計ジャッジ時間 | 4,552 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 TLE * 1 -- * 32 |
コンパイルメッセージ
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
ソースコード
-- yukicoder My Practice
-- author: Leonardone @ NEETSDKASU
import Data.List
main = readLn >>= \n -> print $ g n 1 $ primes [2..] where
f (x, c) p
| x == z * p = f (z, c + 1) p
| c == r * 2 = [x, 1]
| otherwise = [x, p]
where {z = div x p; r = div c 2}
g 1 y _ = y
g x y (p:ps) = let (x2:k:_) = f (x, 0) p in g x2 (y * k) ps
primes [] = []
primes (x:xs) = x : primes [p | p <- xs, x > p * (div x p)]