結果
| 問題 |
No.2461 一点張り
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-19 00:23:35 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 1,856 bytes |
| コンパイル時間 | 5,682 ms |
| コンパイル使用メモリ | 311,804 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-19 00:23:42 |
| 合計ジャッジ時間 | 6,691 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
namespace my{
void main();
void solve();
}
int main(){my::main();}
namespace my{
#define RD(T,...) T __VA_ARGS__;lin(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__)
#define FO(n) for(ll ij=n;ij--;)
#define FOR(i,...) for(auto[i,i##stop,i##step]=range(0,__VA_ARGS__);i<i##stop;i+=i##step)
#define fo(i,...) FO##__VA_OPT__(R)(i __VA_OPT__(,__VA_ARGS__))
#define of(i,...) for(auto[i,i##stop,i##step]=range(1,__VA_ARGS__);i>=i##stop;i-=i##step)
#define fe(a,i,...) for(auto&&__VA_OPT__([)i __VA_OPT__(,__VA_ARGS__]):a)
using namespace std;
using dd=long double;
using ll=long long;
auto range(bool s,ll a,ll b=1e18,ll c=1){if(b==1e18)b=a,(s?b:a)=0;return array{a-s,b,c};}
constexpr char nl=10;
constexpr char sp=32;
template<class V>concept vectorial=is_base_of_v<vector<typename V::value_type>,V>;
template<class V>istream&operator>>(istream&i,vector<V>&v){fe(v,e)i>>e;return i;}
template<class V>ostream&operator<<(ostream&o,const vector<V>&v){fe(v,e)o<<e<<string(&e!=&v.back(),vectorial<V>?nl:sp);return o;}
template<class V>struct vec:vector<V>{
using vector<V>::vector;
vec(const vector<V>&v){vector<V>::operator=(v);}
vec&operator^=(const vec&u){this->insert(this->end(),u.begin(),u.end());return*this;}
vec operator^(const vec&u)const{return vec{*this}^=u;}
vec&operator++(){fe(*this,e)++e;return*this;}
vec&operator--(){fe(*this,e)--e;return*this;}
};
void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<<fixed<<setprecision(15);}
void lin(auto&...a){(cin>>...>>a);}
template<char c=sp>void pp(const auto&...a){ll n=sizeof...(a);((cout<<a<<string(--n>0,c)),...);cout<<nl;}
void main(){io();ll T=1;fo(T)solve();}
void solve(){
LL(T);
fo(T){
RD(dd,p);
LL(K);
vec<dd>E(K+1);
E[K]=1;
of(i,K,1){
E[i]=p*1+(1-p)*(E[i+1]+1);
}
pp(E[1]);
}
}}