結果
| 問題 |
No.1271 初めての級数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-01 20:55:18 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 3,026 bytes |
| コンパイル時間 | 8,419 ms |
| コンパイル使用メモリ | 204,544 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 05:50:49 |
| 合計ジャッジ時間 | 6,894 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
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
ソースコード
{-# LANGUAGE BlockArguments #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NegativeLiterals #-}
{-# LANGUAGE ParallelListComp #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE NPlusKPatterns #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ViewPatterns #-}
import Control.Applicative
import Control.Arrow
import Control.Monad
-- import Control.Monad.Extra
import Control.Monad.Fix
import Control.Monad.ST
import Data.Bits
-- import qualified Data.Vector.Unboxed.Base as UB
-- import qualified Data.Vector.Generic.Mutable.Base
-- as MB
-- import qualified Data.Vector.Generic.Base as GB
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.Foldable
import Data.Functor
import Data.Int
import Data.List
import Data.Maybe
import Data.Monoid
import Data.Ord
import Data.Semigroup ( Max(..)
, Min(..)
, All(..)
, Arg(..)
)
import Data.Ratio
-- import Data.Vector.Unboxing.Mutable ( Unboxable )
-- import qualified Data.Vector.Unboxing.Mutable as V
import System.IO
import Data.Proxy
import GHC.TypeLits
import GHC.Generics ( Generic )
import GHC.Exts
{-# ANN module ("Hlint: ignore Unused LANGUAGE pragma" :: String) #-}
twice :: (a -> a -> b) -> a -> b
twice f x = f x x
both :: Arrow a => a b c -> a (b, b) (c, c)
both = twice (***)
readsLn :: Read a => IO [a]
readsLn = mapM readIO . words =<< getLine
getInt :: IO Int
getInt = fst . fromJust . BS.readInt <$> BS.getLine
getInts :: IO [Int]
getInts = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
getInteger :: IO Integer
getInteger = fst . fromJust . BS.readInteger <$> BS.getLine
getIntegers :: IO [Integer]
getIntegers = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine
main = do
k <- readLn @Double
print if k == 0 then pi * pi / 6 else sum (map recip [1 .. k]) / k