QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501382#5152. Circular Caramel CookieziripoTL 1ms4040kbC++20705b2024-08-02 17:36:322024-08-02 17:36:33

Judging History

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

  • [2024-08-02 17:36:33]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:4040kb
  • [2024-08-02 17:36:32]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

bool cmp(pair<int, int> a, pair<int, int> b) {
	return a.first * a.first + a.second * a.second < b.first * b.first + b.second * b.second;
}

int main() {
	double s; cin >> s;
	double n = s / 4;
	vector<pair<int, int>> a;
	for (int i = 1; i <= sqrtf(sqrtf(n)) + 100; i++)
		for (int j = 1; j <= i; j++)
			a.push_back({ i,j });
	sort(a.begin(), a.end(), cmp);
	vector<vector<int>> v(n + 1, vector<int>(n + 1));
	int sum = 0;
	for (pair<int, int> i : a) {
		if (i.first == i.second)
			sum += 1;
		else
			sum += 2;
		if (sum > n) {
			printf("%.10f", sqrtf(i.first * i.first + i.second * i.second));
			break;
		}
	}
	return 0;
}

详细

Test #1:

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

input:

11

output:

2.2360680103

result:

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

Test #2:

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

input:

59

output:

5.0000000000

result:

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

Test #3:

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

input:

1

output:

1.4142135382

result:

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

Test #4:

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

input:

2

output:

1.4142135382

result:

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

Test #5:

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

input:

3

output:

1.4142135382

result:

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

Test #6:

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

input:

4

output:

2.2360680103

result:

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

Test #7:

score: -100
Time Limit Exceeded

input:

1000000000

output:


result: