結果

問題 No.2461 一点張り
ユーザー 👑 Nachia
提出日時 2021-05-25 17:55:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 784 ms
コンパイル使用メモリ 88,164 KB
最終ジャッジ日時 2025-01-21 18:21:03
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

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