結果

問題 No.144 エラトステネスのざる
ユーザー tonyu0tonyu0
提出日時 2019-06-05 00:36:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 488 bytes
コンパイル時間 978 ms
コンパイル使用メモリ 98,652 KB
実行使用メモリ 50,740 KB
最終ジャッジ日時 2023-10-18 23:16:21
合計ジャッジ時間 4,652 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,696 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <iomanip>
using namespace std;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N;
    map<int,int> m;
    double p,ans = 0.0;
    cin >> N >> p;
    for(int i = 2; i <= N; ++i){
        for(int j = i*2; j <= N; j += i) ++m[j];
        ans += pow(1-p,m[i]);
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}
0