結果

問題 No.144 エラトステネスのざる
ユーザー Onju
提出日時 2015-02-05 23:37:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 273 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 56,056 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 08:37:42
合計ジャッジ時間 978 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 5 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <climits>
#define N_MAX 1000000
using namespace std;

int main()
{
	int N;
	double p, ans;
	cin >> N >> p;
	ans = N - 1;

	for (int i = 2; i <= N; ++i)
	{
		ans -= p*(N - i) / i;
	}
	//ans += N;

	cout << ans;

	return 0;
}
0