QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#715155#7962. 前缀和szy10010#WA 0ms3876kbC++201.2kb2024-11-06 10:38:482024-11-06 10:38:50

Judging History

This is the latest submission verdict.

  • [2024-11-06 10:38:50]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3876kb
  • [2024-11-06 10:38:48]
  • Submitted

answer

#include<iostream>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<string>
#include<vector>
#include<cstring>
#include<algorithm>
#include<unordered_map>

#define pb push_back
#define fi first
#define se second
#define int long long
#define all(x) (x).begin(),(x).end()
#define _for(i, a) for(int i = 0; i < (a); ++i) 
#define _rep(i, a, b) for(int i = (a);i <= (b); ++i)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define u1 (u<<1)
#define u2 (u<<1|1)
//#define endl '\n'
using namespace std;
typedef pair<int,int> PII;

const int INF=0x3f3f3f3f;
const int P=1e9+7;
const int N=1e6+20,M=2*N;
int n,m,k,q[N];
double p;
int l,r;
int erfen1(double now,double x)
{
	int l=1,r=n;//>=x
	while(l<r)
	{
		int mid=l+r>>1;
		(mid*now>=x)?r=mid:l=mid+1;
	}
	return l;
}
int erfen2(double now,double x)
{
	int l=0,r=n;//<=x
	while(l<r)
	{
		cout<<l<<" "<<r<<" "<<now<<endl;
		int mid=l+r+1>>1;
		(mid*now<=x)?l=mid:r=mid-1;
	}
	return l;
}
void solve(){
	cin>>n>>p>>l>>r;
	cout<<(floor(p*r))-(ceil(p*l))+1<<endl;
}
signed main(){
	IOS;
	int T=1;
//	cin>>T;
	_rep(i,1,T){
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 0.5 1 2

output:

1

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3876kb

input:

1 0.529148 1 1

output:

0

result:

wrong answer 1st numbers differ - expected: '0.5291480', found: '0.0000000', error = '0.5291480'