結果
| 問題 |
No.144 エラトステネスのざる
|
| コンテスト | |
| ユーザー |
a3636tako
|
| 提出日時 | 2016-11-24 19:22:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 2,000 ms |
| コード長 | 322 bytes |
| コンパイル時間 | 1,851 ms |
| コンパイル使用メモリ | 157,276 KB |
| 実行使用メモリ | 7,936 KB |
| 最終ジャッジ日時 | 2024-11-27 10:46:44 |
| 合計ジャッジ時間 | 2,419 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int N;
double P;
int cnt[1000005];
int main(){
cin >> N >> P;
for(int i = 2; i <= N; i++){
cnt[i] = 0;
}
double ans = 0;
for(int i = 2; i <= N; i++){
for(int j = 2; i * j <= N; j++){
cnt[i * j] ++;
}
ans += pow(1 - P, cnt[i]);
}
printf("%.10f\n", ans);
}
a3636tako