結果
| 問題 |
No.620 ぐるぐるぐるりん
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-12-20 17:25:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,162 bytes |
| コンパイル時間 | 2,582 ms |
| コンパイル使用メモリ | 195,968 KB |
| 最終ジャッジ日時 | 2025-01-05 06:04:33 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | AC * 1 WA * 27 |
ソースコード
#include <bits/stdc++.h>
#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
os << "sz:" << v.size() << "\n[";
for (const auto& p : v) {
os << p << ",";
}
os << "]\n";
return os;
}
template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
os << "(" << p.first << "," << p.second
<< ")";
return os;
}
constexpr ll MOD = (ll)1e9 + 7LL;
constexpr ld PI = static_cast<ld>(3.1415926535898);
template <typename T>
constexpr T INF = numeric_limits<T>::max() / 10;
struct Vec {
Vec() : dx{0}, dy{0} {}
Vec(const ld dx, const ld dy) : dx{dx}, dy{dy} {}
ld dx;
ld dy;
Vec rotate(const ld theta) const
{
Vec ans;
ans.dx = cos(theta) * dx + sin(theta) * dy;
ans.dy = -sin(theta) * dx + cos(theta) * dy;
return ans;
}
Vec operator*(const ld x) const
{
Vec ans = *this;
ans.dx *= x;
ans.dy *= x;
return ans;
}
ld norm() const
{
return hypot(dx, dy);
}
void normalize()
{
const ld n = norm();
dx /= n;
dy /= n;
}
};
ostream& operator<<(ostream& os, const Vec& v)
{
os << "(" << v.dx << "," << v.dy << ")";
return os;
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int N;
cin >> N;
for (int q = 0; q < N; q++) {
int T;
cin >> T;
ld p, omega, v, gx, gy;
cin >> p >> omega >> v >> gx >> gy;
const ld l = hypot(omega, (ld)(1 + v));
const ld theta = atan(omega / (1 + v));
gx -= pow(l, T) * cos(T * theta);
gy -= pow(l, T) * sin(T * theta);
Vec g{gx, gy};
const ld R = g.norm();
g.normalize();
const ld F = R * (1 - l * l) / (1 - pow(l, 2 * T));
for (int i = 0; i < T; i++) {
Vec v = g.rotate((i + 1 - T) * theta) * (F * pow(l, T - 1 - i));
cout << v.dx << " " << v.dy << endl;
}
}
return 0;
}