結果

問題 No.300 平方数
ユーザー Leonardone
提出日時 2015-11-17 05:33:03
言語 Haskell
(9.10.1)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 376 bytes
コンパイル時間 6,078 ms
コンパイル使用メモリ 173,184 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-09-13 15:51:54
合計ジャッジ時間 5,419 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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

ソースコード

diff #

-- yukicoder My Practice
-- author: Leonardone @ NEETSDKASU

main = readLn >>= print . g 6 . f 9 . f 4 where
    f k x
        | m > 0     = x
        | otherwise = f k d
        where (d, m) = divMod x k
    g i x
        | x < k2     = f k1 x
        | otherwise = g (i + 6) $ f k2 $ f k1 x
        where
            k1 = (i - 1) * (i - 1)
            k2 = (i + 1) * (i + 1)
0