QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#345369#7962. 前缀和BilkyesWA 1ms4116kbC++17508b2024-03-06 21:05:222024-03-06 21:05:22

Judging History

This is the latest submission verdict.

  • [2024-03-06 21:05:22]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 4116kb
  • [2024-03-06 21:05:22]
  • Submitted

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'