QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#345369 | #7962. 前缀和 | Bilkyes | WA | 1ms | 4116kb | C++17 | 508b | 2024-03-06 21:05:22 | 2024-03-06 21:05:22 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define int long long
typedef long long ll;
typedef pair<int,int> PII;
const int N=2e5+10,M=4e5+10,mod=6666623333;
int T;
int n,l,r;
double q;
void solve()
{
cin>>n>>q>>l>>r;
double ans=2.*q*(1.-(double)pow(q,r-l+1))/(1.-q)-q;
printf("%.6lf",ans);
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
T=1;
while(T--)
{
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 4116kb
input:
3 0.5 1 2
output:
1.000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 4076kb
input:
1 0.529148 1 1
output:
0.529148
result:
ok found '0.5291480', expected '0.5291480', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 4056kb
input:
1000000000 0.592692 495948205 808386938
output:
2.317597
result:
wrong answer 1st numbers differ - expected: '185179938.1320000', found: '2.3175970', error = '1.0000000'