QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#426898#4196. Monty's Hallrania__#AC ✓62ms19428kbC++20710b2024-06-01 00:07:392024-06-01 00:07:39

Judging History

你现在查看的是最新测评结果

  • [2024-06-01 00:07:39]
  • 评测
  • 测评结果:AC
  • 用时:62ms
  • 内存:19428kb
  • [2024-06-01 00:07:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
    long double props[1000006];
void solve()
{
    long double d,s,e;
    cin>>d>>s>>e;
    long double sum=0;
    for(int i=1;i<=d-e;i++)
    {
        if(i<=s)props[i]=1.00/d,sum+=1.00/d;
        else props[i] = (1-sum)/(d-s-e);
    }
    sort(props+1,props+(int)(d-e+1));
    reverse(props+1,props+(int)(d-e+1));
    long double ans=0;
    for(int i=1;i<=s;i++)
    {
        ans+=props[i];
    }
    cout<<fixed<<setprecision(7)<<ans<<endl;

}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }

}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3828kb

input:

3 1 1

output:

0.6666667

result:

ok found '0.6666667', expected '0.6666670', error '0.0000003'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

8 4 2

output:

0.7500000

result:

ok found '0.7500000', expected '0.7500000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

15 4 2

output:

0.3259259

result:

ok found '0.3259259', expected '0.3259259', error '0.0000000'

Test #4:

score: 0
Accepted
time: 58ms
memory: 19412kb

input:

1000000 1 1

output:

0.0000010

result:

ok found '0.0000010', expected '0.0000010', error '0.0000000'

Test #5:

score: 0
Accepted
time: 62ms
memory: 19428kb

input:

1000000 999998 1

output:

0.9999990

result:

ok found '0.9999990', expected '0.9999990', error '0.0000000'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

1000000 1 999998

output:

0.9999990

result:

ok found '0.9999990', expected '0.9999990', error '0.0000000'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

78 39 18

output:

0.7307692

result:

ok found '0.7307692', expected '0.7307692', error '0.0000000'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

95 67 2

output:

0.7263158

result:

ok found '0.7263158', expected '0.7263158', error '0.0000000'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

132 37 42

output:

0.5024300

result:

ok found '0.5024300', expected '0.5024300', error '0.0000000'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

358 286 67

output:

0.9860335

result:

ok found '0.9860335', expected '0.9860335', error '0.0000000'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

507 268 214

output:

0.9506903

result:

ok found '0.9506903', expected '0.9506903', error '0.0000000'

Test #12:

score: 0
Accepted
time: 14ms
memory: 7888kb

input:

307521 21170 77603

output:

0.0944327

result:

ok found '0.0944327', expected '0.0944327', error '0.0000000'

Test #13:

score: 0
Accepted
time: 43ms
memory: 15688kb

input:

801885 303025 80078

output:

0.4501498

result:

ok found '0.4501498', expected '0.4501498', error '0.0000000'

Test #14:

score: 0
Accepted
time: 32ms
memory: 13792kb

input:

841840 457853 312238

output:

0.9147712

result:

ok found '0.9147712', expected '0.9147712', error '0.0000000'

Test #15:

score: 0
Accepted
time: 2ms
memory: 6616kb

input:

141716 97110 2985

output:

0.7063070

result:

ok found '0.7063070', expected '0.7063070', error '0.0000000'

Test #16:

score: 0
Accepted
time: 3ms
memory: 5512kb

input:

107479 105123 477

output:

0.9825175

result:

ok found '0.9825175', expected '0.9825175', error '0.0000000'