結果
| 問題 | No.144 エラトステネスのざる |
| コンテスト | |
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2015-10-28 22:19:20 |
| 言語 | Haskell (9.14.1 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 326 bytes |
| 記録 | |
| コンパイル時間 | 994 ms |
| コンパイル使用メモリ | 196,352 KB |
| 実行使用メモリ | 7,860 KB |
| 最終ジャッジ日時 | 2026-08-25 22:13:22 |
| 合計ジャッジ時間 | 5,510 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 TLE * 1 -- * 6 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
import Control.Applicative ((<$>))
countFactors :: Int -> Int
countFactors n = length [f | f <- [1 .. n], mod n f == 0]
prob :: Double -> Int -> Double
prob p n = (1 - p) ** (fromIntegral $ countFactors n - 2)
main :: IO ()
main = do
(n : p : _) <- words <$> getLine
print $ sum $ map (prob $ read p) [2 .. read n]
はむ吉🐹