QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#816082 | #9869. Horizon Scanning | tamir# | Compile Error | / | / | C++20 | 997b | 2024-12-15 21:50:20 | 2024-12-15 21:50:20 |
Judging History
answer
// #include<bits/stdc++.h>
#include<iostream>
#include<iomanip>
using namespace std;
double pi = acos(-1.0);
double eps = 1e-6;
void solve() {
int n, k;
cin >> n >> k;
vector<pair<double, pair<int, int>>> a(n);
for(int i = 0; i < n; i++){
cin >> a[i].second.first >> a[i].second.second;
a[i].first = atan2(a[i].second.second, a[i].second.first);
}
if(abs(a[0].first - a.back().first) < eps) {
cout << fixed << setprecision(10) << 2 * pi << '\n';
return;
}
sort(a.begin(), a.end());
double mx = 0.0;
for(int i = 0; i < n; i++) {
int j = (i + k) % n;
double x = a[j].first - a[i].first;
if(i + k >= n){
x += 2 * pi;
}
mx = max(mx, x);
}
cout << fixed << setprecision(10) << mx << '\n';
}
int main() {
ios::sync_with_stdio(0); cin.tie(nullptr);
int t = 1;
cin >> t;
while(t--) {
solve();
}
}
详细
answer.code:6:13: error: ‘acos’ was not declared in this scope 6 | double pi = acos(-1.0); | ^~~~ answer.code: In function ‘void solve()’: answer.code:12:5: error: ‘vector’ was not declared in this scope 12 | vector<pair<double, pair<int, int>>> a(n); | ^~~~~~ answer.code:4:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 3 | #include<iomanip> +++ |+#include <vector> 4 | using namespace std; answer.code:12:40: error: expected primary-expression before ‘>’ token 12 | vector<pair<double, pair<int, int>>> a(n); | ^ answer.code:12:42: error: ‘a’ was not declared in this scope 12 | vector<pair<double, pair<int, int>>> a(n); | ^ answer.code:15:22: error: ‘atan2’ was not declared in this scope 15 | a[i].first = atan2(a[i].second.second, a[i].second.first); | ^~~~~ answer.code:22:5: error: ‘sort’ was not declared in this scope; did you mean ‘short’? 22 | sort(a.begin(), a.end()); | ^~~~ | short