QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501388#5152. Circular Caramel CookieziripoTL 0ms0kbC++20689b2024-08-02 17:41:032024-08-02 17:41:03

Judging History

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

  • [2024-08-02 17:41:03]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-08-02 17:41:03]
  • 提交

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 <= 10000; 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: 0
Time Limit Exceeded

input:

11

output:


result: