QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#815840 | #9869. Horizon Scanning | tamir# | Compile Error | / | / | C++20 | 931b | 2024-12-15 17:43:42 | 2024-12-15 17:43:44 |
Judging History
answer
#include<iostream>
#include<iomanip>
using namespace std;
double pi = acos(-1.0);
double eps = 1e-9;
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.first, a[i].second.second);
}
if(n == 1) {
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(x < 0){
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:5:13: error: ‘acos’ was not declared in this scope 5 | double pi = acos(-1.0); | ^~~~ answer.code: In function ‘void solve()’: answer.code:11:5: error: ‘vector’ was not declared in this scope 11 | vector<pair<double, pair<int, int>>> a(n); | ^~~~~~ answer.code:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 2 | #include<iomanip> +++ |+#include <vector> 3 | using namespace std; answer.code:11:40: error: expected primary-expression before ‘>’ token 11 | vector<pair<double, pair<int, int>>> a(n); | ^ answer.code:11:42: error: ‘a’ was not declared in this scope 11 | vector<pair<double, pair<int, int>>> a(n); | ^ answer.code:14:22: error: ‘atan2’ was not declared in this scope 14 | a[i].first = atan2(a[i].second.first, a[i].second.second); | ^~~~~ answer.code:20:5: error: ‘sort’ was not declared in this scope; did you mean ‘short’? 20 | sort(a.begin(), a.end()); | ^~~~ | short