結果

問題 No.2461 一点張り
コンテスト
ユーザー Nzt3
提出日時 2023-09-08 21:40:30
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 2,000 ms
+ 735µs
コード長 434 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,281 ms
コンパイル使用メモリ 210,916 KB
実行使用メモリ 9,864 KB
最終ジャッジ日時 2026-10-16 01:55:34
合計ジャッジ時間 2,629 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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