結果
| 問題 |
No.1385 Simple Geometry 2
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-10-25 12:56:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,072 bytes |
| コンパイル時間 | 1,587 ms |
| コンパイル使用メモリ | 195,644 KB |
| 実行使用メモリ | 30,760 KB |
| 最終ジャッジ日時 | 2025-10-25 12:57:07 |
| 合計ジャッジ時間 | 13,009 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 65 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 10;
const double Pi = acos(-1);
int n, L;
double t[N];
double sin1[N], sin2[N];
double cos1[N], cos2[N];
signed main() {
// freopen("geometry.in", "r", stdin);
// freopen("geometry.out", "w", stdout);
ios::sync_with_stdio(false), cin.tie(0);
cin >> n >> L;
for (int i = 1, x; i <= n; i++) cin >> x, t[i] = Pi * x / L;
for (int i = n; i >= 1; i--) {
sin1[i] = sin1[i + 1] + sin(t[i]), sin2[i] = sin2[i + 1] + i * sin(t[i]);
cos1[i] = cos1[i + 1] + cos(t[i]), cos2[i] = cos2[i + 1] + i * cos(t[i]);
}
double ansx = 0, ansy = 0;
for (int i = 1; i <= n; i++) {
ansx += (n + 2 * i) * (cos(t[i]) * cos1[i + 1] - sin(t[i]) * sin1[i + 1]) - 2 * (cos(t[i]) * cos2[i + 1] - sin(t[i]) * sin2[i + 1]);
ansy += (n + 2 * i) * (sin(t[i]) * cos1[i + 1] + cos(t[i]) * sin1[i + 1]) - 2 * (sin(t[i]) * cos2[i + 1] + cos(t[i]) * sin2[i + 1]);
}
int p = n * (n - 1) * (n - 2) / 6;
printf("%.15lf %.15lf", ansx / p, ansy / p);
}
vjudge1