QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212497 | #2964. Loot Chest | ucup-team1004 | AC ✓ | 0ms | 3980kb | C++14 | 1.1kb | 2023-10-13 16:31:45 | 2023-10-13 16:31:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<typename T>
ostream& operator << (ostream &out,const vector<T>&x){
if(x.empty())return out<<"[]";
out<<'['<<x[0];
for(int len=x.size(),i=1;i<len;i++)out<<','<<x[i];
return out<<']';
}
template<typename T>
vector<T> ary(const T *a,int l,int r){
return vector<T>{a+l,a+1+r};
}
template<typename T>
void debug(T x){
cerr<<x<<'\n';
}
template<typename T,typename ...S>
void debug(T x,S ...y){
cerr<<x<<' ',debug(y...);
}
const int N=1e2+10;
struct zj{
double k,b;//k*f[0]+b
zj operator + (const zj &x)const{
return {k+x.k,b+x.b};
}
zj operator - (const zj &x)const{
return {k-x.k,b-x.b};
}
zj operator * (const double &x)const{
return {k*x,b*x};
}
}f[N];
int dL,dW,G,L;
double Gp,Lp;
int main(){
cin>>dL>>dW>>G>>L,Gp=G/100.0,Lp=L/100.0;
f[100]={1-Gp,1/(1-Lp)};
for(int i=99;i>=0;i--){
f[i]=f[min(100,i+dL)]*Lp+f[min(100,i+dW)]*(1-Lp)*(1-i/100.0);
f[i].b+=1,f[i].k+=(1-Lp)*(i/100.0)*(1-Gp);
// debug(i,f[i].k,f[i].b);
}
printf("%.15lf\n",f[0].b/(1-f[0].k));
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3784kb
input:
1 100 50 0
output:
4.000000000000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
50 50 100 25
output:
2.833333333333333
result:
ok found '2.8333333', expected '2.8333333', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
1 100 10 0
output:
20.000000000000004
result:
ok found '20.0000000', expected '20.0000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 3 10 80
output:
197.005706719956578
result:
ok found '197.0057067', expected '197.0057067', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
1 1 100 0
output:
13.209960630215980
result:
ok found '13.2099606', expected '13.2099606', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
1 100 100 0
output:
2.000000000000000
result:
ok found '2.0000000', expected '2.0000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
1 1 1 0
output:
1320.996063021567352
result:
ok found '1320.9960630', expected '1320.9960630', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3972kb
input:
1 2 1 99
output:
14648.653617576865145
result:
ok found '14648.6536176', expected '14648.6536176', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
100 100 1 1
output:
201.010101010100868
result:
ok found '201.0101010', expected '201.0101010', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
1 3 1 49
output:
1326.893953584498831
result:
ok found '1326.8939536', expected '1326.8939536', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
69 91 78 18
output:
3.011682301438399
result:
ok found '3.0116823', expected '3.0116823', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
40 13 94 9
output:
4.338797656641971
result:
ok found '4.3387977', expected '4.3387977', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
88 43 61 71
output:
7.713913183719614
result:
ok found '7.7139132', expected '7.7139132', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
13 46 56 40
output:
6.790049790476190
result:
ok found '6.7900498', expected '6.7900498', error '0.0000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3916kb
input:
79 82 27 70
output:
16.793827160493830
result:
ok found '16.7938272', expected '16.7938272', error '0.0000000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
62 57 67 33
output:
4.337369124526620
result:
ok found '4.3373691', expected '4.3373691', error '0.0000000'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
3 1 1 97
output:
4951.756246922321225
result:
ok found '4951.7562469', expected '4951.7562469', error '0.0000000'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3964kb
input:
1 2 54 50
output:
28.323919760216175
result:
ok found '28.3239198', expected '28.3239198', error '0.0000000'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3908kb
input:
2 3 6 1
output:
132.831285269189635
result:
ok found '132.8312853', expected '132.8312853', error '0.0000000'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
2 3 34 2
output:
23.589985115351265
result:
ok found '23.5899851', expected '23.5899851', error '0.0000000'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
66 63 52 38
output:
5.714429280397022
result:
ok found '5.7144293', expected '5.7144293', error '0.0000000'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
62 46 75 27
output:
3.852912391598174
result:
ok found '3.8529124', expected '3.8529124', error '0.0000000'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
65 18 37 17
output:
9.490843403208299
result:
ok found '9.4908434', expected '9.4908434', error '0.0000000'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
97 13 80 32
output:
4.430480978075563
result:
ok found '4.4304810', expected '4.4304810', error '0.0000000'