結果
| 問題 |
No.144 エラトステネスのざる
|
| ユーザー |
buey_t
|
| 提出日時 | 2022-12-12 01:22:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 436 bytes |
| コンパイル時間 | 751 ms |
| コンパイル使用メモリ | 82,420 KB |
| 実行使用メモリ | 46,452 KB |
| 最終ジャッジ日時 | 2024-10-15 20:18:17 |
| 合計ジャッジ時間 | 15,313 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 3 TLE * 1 |
ソースコード
#include <iostream>
#include <unordered_map>
#include <cmath>
using namespace std;
int main()
{
double N, p;
cin >> N >> p;
int N_int = (int)N;
double ans = 0;
unordered_map<int, int> memo;
for (int i = 2; i <= N_int; i++)
{
for (int j = i + i; j <= N_int; j += i)
{
memo[j] += 1;
}
ans += pow(1 - p, memo[i]);
}
cout << ans << endl;
return 0;
}
buey_t