QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#226722#5152. Circular Caramel CookieFyind#WA 0ms3896kbC++23566b2023-10-26 14:36:442023-10-26 14:36:44

Judging History

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

  • [2023-10-26 14:36:44]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3896kb
  • [2023-10-26 14:36:44]
  • 提交

answer

#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

bool check(ll x, ll s) {
	ll cnt = 0;
	for (ll i = 1; i * i <= x; ++i)
		cnt += sqrt(x - 1ll * i * i);//, cout << cnt << ',';
	// cout << x << ':' << cnt << ',' << s << endl;
	return cnt < s;
}
int main() {
	ll s;
	cin >> s;
	s = (s + 3) / 4;
	// cout << s << endl;
	ll l = 0, r = s * s;
	while (l <= r) {
		ll mid = (l + r) / 2;
		if(check(mid, s))
			l = mid + 1;
		else 
			r = mid - 1;
	}
	// cout << l << endl;
	cout << fixed << setprecision(8) << sqrt(l) << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

11

output:

2.23606798

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #2:

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

input:

59

output:

5.00000000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #3:

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

input:

1

output:

1.41421356

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #4:

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

input:

2

output:

1.41421356

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #5:

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

input:

3

output:

1.41421356

result:

ok found '1.4142136', expected '1.4142136', error '0.0000000'

Test #6:

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

input:

4

output:

1.41421356

result:

wrong answer 1st numbers differ - expected: '2.2360680', found: '1.4142136', error = '0.3675445'