結果
問題 | No.144 エラトステネスのざる |
ユーザー |
![]() |
提出日時 | 2021-04-22 15:39:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 438 bytes |
コンパイル時間 | 1,519 ms |
コンパイル使用メモリ | 168,504 KB |
実行使用メモリ | 7,640 KB |
最終ジャッジ日時 | 2024-07-04 06:22:07 |
合計ジャッジ時間 | 2,415 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
/*** @FileName a.cpp* @Author kanpurin* @Created 2021.04.22 15:38:29**/#include "bits/stdc++.h"using namespace std;typedef long long ll;int main() {int n;double p;cin >> n >> p;vector<int> a(n+1);double ans = 0;for (int i = 2; i <= n; i++) {for (int j = i+i; j <= n; j+=i) {a[j]++;}ans += pow(1-p,a[i]);}printf("%.10f\n",ans);return 0;}