QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#58008 | #4838. Rotate Sum 2 | MIT01# | Compile Error | / | / | C++17 | 1006b | 2022-10-24 09:04:25 | 2022-10-24 09:04:28 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-10-24 09:04:28]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-10-24 09:04:25]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
static_assert(sizeof(long double) == 16);
static_assert(sizeof(int) == 0); // force CE
constexpr const long double PI = acosl(-1.0L);
long double x[100005], y[100005];
long double sx2, sx, sy2, sy;
long double ans1, ans2;
int n;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%Lf%Lf", x+i, y+i);
sx2 += x[i]*x[i], sx += x[i];
sy2 += y[i]*y[i], sy += y[i];
}
x[n] = x[0], y[n] = y[0];
x[n+1] = x[1], y[n+1] = y[1];
// area of polygon
for (int i = 0; i < n; i++) {
ans1 += x[i]*y[i+1]-x[i+1]*y[i];
}
ans1 /= 2;
// sectors
for (int i = 1; i <= n; i++) {
long double dot = (x[i+1]-x[i])*(x[i-1]-x[i]) + (y[i+1]-y[i])*(y[i-1]-y[i]);
long double angle = acosl(dot / hypotl(x[i+1]-x[i], y[i+1]-y[i]) / hypotl(x[i-1]-x[i], y[i-1]-y[i]));
ans2 += (PI - angle) * (n*x[i]*x[i] + n*y[i]*y[i] - 2*sx*x[i] - 2*sy*y[i] + sx2 + sy2);
}
ans2 /= 2*n;
printf("%.17Lf\n", ans1+ans2);
return 0;
}
詳細信息
answer.code:5:27: error: static assertion failed 5 | static_assert(sizeof(int) == 0); // force CE | ~~~~~~~~~~~~^~~~ answer.code: In function ‘int main()’: answer.code:14:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ answer.code:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%Lf%Lf", x+i, y+i); | ~~~~~^~~~~~~~~~~~~~~~~~~~