QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501225#5152. Circular Caramel CookienaichakafeiWA 1ms3884kbC++20989b2024-08-02 15:47:562024-08-02 15:48:01

Judging History

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

  • [2024-08-02 15:48:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3884kb
  • [2024-08-02 15:47:56]
  • 提交

answer

/*
    /\_/\
   (= ._.)
   / >  \>
*/
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <cstdio>
#include <cmath>
#include <cassert>
#define int long long
#define double long double
using namespace std;
const int N = 4e5 + 10, M = 1e6 + 10, MOD = 1e9 + 7;
int a[N];
pair<int, int> b[N];
int check(double r) {
	int ans = 0;
	for (int i = 1; i <= r; i++) {
		int x = i, y = sqrt(r * r - x * x);
		ans += y;
	}
	return ans * 4;
}
void solve() {
	int n;
	cin >> n;
	double l = 0, r = 1e5;
	while (r - l > 1e-10) {
		double mid = (r + l) / 2;
		if (check(mid) >= n) {
			r = mid;
		} else {
			l = mid;
		}
	}
	printf("%.10Lf", l);
}
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TT = 1;
	//cin >> TT;
	while (TT--) {
		solve();
	}
	return 0;
}
/*
    /\_/\
   (= ._.)
   / >  \>
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

11

output:

2.2360679774

result:

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

Test #2:

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

input:

59

output:

5.0000000000

result:

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

Test #3:

score: 0
Accepted
time: 1ms
memory: 3876kb

input:

1

output:

1.4142135623

result:

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

Test #4:

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

input:

2

output:

1.4142135623

result:

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

Test #5:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

3

output:

1.4142135623

result:

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

Test #6:

score: -100
Wrong Answer
time: 1ms
memory: 3712kb

input:

4

output:

1.4142135623

result:

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