結果

問題 No.1807 UMA Gacha
ユーザー MasKoaTSMasKoaTS
提出日時 2022-12-08 11:51:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 2,047 ms
コンパイル使用メモリ 194,756 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-22 11:10:23
合計ジャッジ時間 3,047 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// ChatGPT

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

int main() {
	int n;
	double p;
	cin >> n >> p;
	
	// 200回以上行う場合、「究極 UMA 」が必ず1匹手に入るので、答えは1
	if (n >= 200) {
	    cout << fixed << setprecision(9) << 1.0 << endl;
	    return 0;
	}
	
	// 「究極 UMA 」が 1 匹以上手に入る確率は、「究極 UMA 」が 0 匹手に入る確率を1から引いたもの
	double ans = 1.0 - pow(1.0 - p, n);
	
	// 小数点以下9桁で出力
	cout << fixed << setprecision(9) << ans << endl;
	
	return 0;
}
0