結果
問題 |
No.144 エラトステネスのざる
|
ユーザー |
![]() |
提出日時 | 2021-04-22 15:38:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 436 bytes |
コンパイル時間 | 1,621 ms |
コンパイル使用メモリ | 168,848 KB |
実行使用メモリ | 7,680 KB |
最終ジャッジ日時 | 2024-07-04 06:22:02 |
合計ジャッジ時間 | 2,723 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 3 |
ソースコード
/** * @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]); } cout << ans << endl; return 0; }