結果
問題 | No.144 エラトステネスのざる |
ユーザー |
![]() |
提出日時 | 2018-02-05 23:50:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 56 ms / 2,000 ms |
コード長 | 354 bytes |
コンパイル時間 | 289 ms |
コンパイル使用メモリ | 38,528 KB |
実行使用メモリ | 7,424 KB |
最終ジャッジ日時 | 2024-07-08 08:34:09 |
合計ジャッジ時間 | 1,286 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <cstdio>#include <cmath>using namespace std;int divisor[1000010];int main() {int N; double p;scanf("%d%lf", &N, &p);double ans = 0.0;for(int k=2; k<=N; k++) {for(int m=k; m<=N; m+=k) {divisor[m]++;}ans += pow(1-p, divisor[k] - 1);}printf("%.12f\n", ans);return 0;}