結果
| 問題 |
No.144 エラトステネスのざる
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-02-10 04:26:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 318 bytes |
| コンパイル時間 | 498 ms |
| コンパイル使用メモリ | 58,120 KB |
| 実行使用メモリ | 11,460 KB |
| 最終ジャッジ日時 | 2024-06-23 16:56:55 |
| 合計ジャッジ時間 | 1,501 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 3 |
ソースコード
#include <iostream>
#include <algorithm>
#include <numeric>
using namespace std;
double dp[1000010];
int main()
{
int n;
double p;
while (cin>>n>>p) {
fill(dp, dp+n+1, 1);
for(int i=2;i<=n;++i) for(int j=i+i;j<=n;j+=i) dp[j]*=1-p;
cout<<accumulate(dp+2, dp+n+1, 0.0)<<endl;
}
}
hogeover30