結果
| 問題 |
No.144 エラトステネスのざる
|
| コンテスト | |
| ユーザー |
Kyutatsu
|
| 提出日時 | 2025-09-15 21:27:16 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 357 bytes |
| コンパイル時間 | 1,034 ms |
| コンパイル使用メモリ | 104,588 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-15 21:27:19 |
| 合計ジャッジ時間 | 2,544 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 3 |
ソースコード
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main() {
int N; cin >> N;
double P; cin >> P;
double res = 0.0;
vector<int> divided(N+1);
for (int i=2;i<=N;i++) {
res += pow(1.0-P, divided[i]);
for (int j=i;j<=N;j+=i) {
divided[j]++;
}
}
cout << res << endl;
}
Kyutatsu