結果

問題 No.144 エラトステネスのざる
ユーザー ytft
提出日時 2021-03-16 14:25:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 372 bytes
コンパイル時間 1,711 ms
コンパイル使用メモリ 167,380 KB
実行使用メモリ 7,680 KB
最終ジャッジ日時 2024-11-08 00:08:25
合計ジャッジ時間 3,011 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin>>N;
    vector<int> num(N+1,0);
    int j;
    for(int i=2;i*2<=N;i++){
        j=2;
        while(i*j<=N){
            num[i*j]++;
            j++;
        }
    }
    double p;
    cin>>p;
    double ans=0;
    for(int i=2;i<=N;i++){
        ans+=pow(1-p,num[i]);
    }
    cout<<ans<<endl;
}
0