結果
| 問題 |
No.300 平方数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-17 01:46:39 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 46 ms / 1,000 ms |
| コード長 | 555 bytes |
| コンパイル時間 | 2,093 ms |
| コンパイル使用メモリ | 177,280 KB |
| 実行使用メモリ | 8,064 KB |
| 最終ジャッジ日時 | 2024-09-13 15:44:37 |
| 合計ジャッジ時間 | 3,411 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 = f d p (c + 1)
| otherwise = (x, c)
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