QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#300800#7962. 前缀和defyers#WA 1ms3796kbC++20667b2024-01-08 20:13:242024-01-08 20:13:24

Judging History

This is the latest submission verdict.

  • [2024-01-08 20:13:24]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3796kb
  • [2024-01-08 20:13:24]
  • Submitted

answer

#include "bits/stdc++.h"
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

using ll = long long;
using LL = long long;


void solve(int TC) {
	ll n;
	long double p;
	ll l, r;

	cin >> n >> p >> l >> r;

	ll P = round(p * 1000000);

	ll LP = l * P;
	ll RP = r * P;

	ll L = LP / 1000000 + (LP % 1000000 != 0);
	ll R = RP / 1000000;


	if (L < 1) L = 1;
	if (R > n) R = n;

	ll ans = max(0ll, R - L + 1);

	cout << ans << "\n";

}

int32_t main() {
	cin.tie(0)->sync_with_stdio(0);
	cout << fixed << setprecision(10);

	int t = 1;
	// cin >> t;

	for (int i = 1; i <= t; i++) {
		solve(i);
	}
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3796kb

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: 1ms
memory: 3696kb

input:

1 0.529148 1 1

output:

0

result:

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