結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-11-16 23:48:15 | 
| 言語 | Haskell  (9.10.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 437 bytes | 
| コンパイル時間 | 5,941 ms | 
| コンパイル使用メモリ | 172,544 KB | 
| 実行使用メモリ | 14,008 KB | 
| 最終ジャッジ日時 | 2024-09-13 15:42:51 | 
| 合計ジャッジ時間 | 8,744 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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 $ takeWhile (<= n) $ primes [2..] where
    f (x, c) p
        | mod x p == 0 = f (div x p, c + 1) p
        | mod c 2 == 0 = [x, 1]
        | otherwise    = [x, p]
    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, mod p x > 0]