結果
| 問題 | 
                            No.300 平方数
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-11-17 01:48:15 | 
| 言語 | Haskell  (9.10.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 44 ms / 1,000 ms | 
| コード長 | 507 bytes | 
| コンパイル時間 | 1,788 ms | 
| コンパイル使用メモリ | 180,608 KB | 
| 実行使用メモリ | 8,192 KB | 
| 最終ジャッジ日時 | 2024-09-13 15:44:50 | 
| 合計ジャッジ時間 | 3,407 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 43 | 
コンパイルメッセージ
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
main = readLn >>= print . g where
    f x p c
        | m > 0     = (x, c)
        | otherwise = f d p (c + 1) where
            (d, m) = divMod x p
    g x = r2 * (h d2 3 1) where
        (d2, c2) = f x 2 0
        r2 = 1 + (mod c2 2)
        h z i y
            | z == 1    = y
            | z < i * i = y * z
            | otherwise = h d (i + 2) (y * r) where
                (d, c) = f z i 0
                r = if 1 == mod c 2 then i else 1