結果
問題 |
No.98 円を描こう
|
ユーザー |
|
提出日時 | 2018-01-20 21:20:49 |
言語 | Haskell (9.10.1) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 359 bytes |
コンパイル時間 | 2,768 ms |
コンパイル使用メモリ | 173,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 03:47:57 |
合計ジャッジ時間 | 2,808 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 6 |
コンパイルメッセージ
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
ソースコード
import Control.Applicative ((<$>)) main :: IO () main = do solve <$> getl (map read . words) >>= print solve :: [Int] -> Int solve [xp, yp] = let l = ceiling $ sqrt $ fromIntegral $ 4 * xp ^ 2 + 4 * yp ^ 2 in f l where f x = if x ^ 2 > 4 * xp ^ 2 + 4 * yp ^ 2 then x else x + 1 getl :: (String -> a) -> IO a getl f = f <$> getLine