結果
| 問題 |
No.2461 一点張り
|
| コンテスト | |
| ユーザー |
Lynkcat
|
| 提出日時 | 2023-09-08 21:24:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 757 bytes |
| コンパイル時間 | 1,940 ms |
| コンパイル使用メモリ | 166,492 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 14:13:16 |
| 合計ジャッジ時間 | 2,610 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) (int)((x).size())
#define int ll
//#define N
using namespace std;
inline double quickPower(double x,ll y)
{
double res=1;
while (y)
{
if (y&1) res=res*x;
x=x*x;
y>>=1;
}
return res;
}
void BellaKira()
{
double p;
int n;
cin>>p>>n;
double ans=0;
for (int i=1;i<=n;i++)
{
ans+=p*quickPower(1.0-p,i-1)*i;
}
ans+=quickPower(1.0-p,n)*n;
cout<<fixed<<setprecision(10)<<ans<<'\n';
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
cin>>T;
while (T--)
{
BellaKira();
}
}
Lynkcat