結果
| 問題 | No.144 エラトステネスのざる |
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2015-07-06 23:57:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 414 bytes |
| 記録 | |
| コンパイル時間 | 1,342 ms |
| コンパイル使用メモリ | 159,320 KB |
| 実行使用メモリ | 7,424 KB |
| 最終ジャッジ日時 | 2024-07-08 01:23:45 |
| 合計ジャッジ時間 | 3,166 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
double po(double p,int q){
double ans=1;
for(int i=0;i<q;i++) ans*=p;
return ans;
}
int main(){
int n;
double p; cin>>n>>p;
vector<int> divisor(n+1,0);
for(int i=2;i<=n;i++){
for(int j=2;i*j<=n;j++) divisor[i*j]++;
cout<<divisor[i]<<" ";
}
cout<<endl;
double ans=0;
for(int i=2;i<=n;i++) ans+=po(1-p,divisor[i]);
printf("%.10lf\n",ans);
return 0;
}
fiord