結果
| 問題 |
No.144 エラトステネスのざる
|
| コンテスト | |
| ユーザー |
bin101
|
| 提出日時 | 2019-10-02 14:02:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 2,000 ms |
| コード長 | 561 bytes |
| コンパイル時間 | 812 ms |
| コンパイル使用メモリ | 72,528 KB |
| 実行使用メモリ | 7,936 KB |
| 最終ジャッジ日時 | 2024-10-03 05:59:26 |
| 合計ジャッジ時間 | 1,636 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;
int d[1100000];
int main(){
int N;
double p,ans=0.0;
cin>>N>>p;
for(int k=2;k<=N;k++){
for(int m=k;m<=N;m+=k){
d[m]++;
}
ans+=pow(1-p,d[k]-1);
}
printf("%.6lf\n",ans);
}
bin101