結果

問題 No.2461 一点張り
ユーザー Nzt3
提出日時 2023-09-08 21:40:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 1,818 ms
コンパイル使用メモリ 192,460 KB
最終ジャッジ日時 2025-02-16 19:42:04
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  double P;
  int K;
  cin>>P>>K;
  double ans=0,t=1;
  for(int i=1;i<K;i++){
    ans+=t*P*i;
    t*=(1-P);
  }
  ans+=t*K;
  cout<<setprecision(10)<<ans<<'\n';
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int test_case;
  cin>>test_case;
  while (test_case--){
    solve();
  }
}
0