結果
| 問題 |
No.2461 一点張り
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-29 01:23:26 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 581 bytes |
| コンパイル時間 | 3,074 ms |
| コンパイル使用メモリ | 244,948 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-21 20:02:08 |
| 合計ジャッジ時間 | 3,733 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 1
#endif
void solve() {
long double p;
int k;
cin >> p >> k;
if (p == 0) {
cout << k << '\n';
} else {
long double c = 1;
for (int i = 0; i < k; i++) {
c *= (1 - p);
}
long double ans = (1 - c) / p;
cout << fixed << setprecision(15) << ans << '\n';
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
solve();
}
}