Cleaner 06, thanks Jacky and Lumi

This commit is contained in:
Natty 2023-12-06 19:39:32 +01:00
parent 4ffa71e1cc
commit 75639dcf20
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
2 changed files with 2 additions and 3 deletions

View File

@ -18,7 +18,7 @@ main = do
lns <- lines <$> getContents
print
$ product
$ (\(time, dist) -> (\x -> floor (time / 2 + x) - ceiling (time / 2 - x) + 1) . subtract 0.000001 . sqrt . subtract dist . (**2) . (/2) $ time)
$ (\(time, dist) -> (\x -> ceiling (time / 2 + x) - floor (time / 2 - x) - 1) . sqrt . subtract dist . (**2) . (/2) $ time)
<$> ((bimap (fromIntegral @_ @Double) (fromIntegral @_ @Double)
. parseRace <$>)
. drop 1

View File

@ -17,8 +17,7 @@ main :: IO ()
main = do
lns <- lines <$> getContents
print
$ (\(time, dist) -> (\x -> floor (time / 2 + x) - ceiling (time / 2 - x) + 1)
. subtract 0.000001
$ (\(time, dist) -> (\x -> ceiling (time / 2 + x) - floor (time / 2 - x) - 1)
. sqrt
. subtract dist
. (**2)