結果

問題 No.2461 一点張り
ユーザー 👑 NachiaNachia
提出日時 2021-05-25 17:55:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 673 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-01 01:07:44
合計ジャッジ時間 1,395 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 4 ms
4,384 KB
testcase_03 AC 5 ms
4,384 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 5 ms
4,376 KB
testcase_07 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
  cout << setprecision(7);
  int T;
  cin >> T;
  while(T--){
    double p;
    int K;
    cin >> p >> K;
    if(p != 0) p = (p * (1.0 + 1.0e-12) + 1.0e-12);
    if(p == 0){ cout << K << "\n"; }
    else{
      double ans = (1.0 - pow(1.0 - p, K)) / p;
      cout << ans << "\n";
    }
  }
  return 0;
}
0