結果

問題 No.620 ぐるぐるぐるりん
ユーザー PachicobuePachicobue
提出日時 2017-12-20 22:13:17
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 49 ms / 1,000 ms
コード長 865 bytes
コンパイル時間 2,042 ms
コンパイル使用メモリ 202,692 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-03 21:29:46
合計ジャッジ時間 3,814 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 49 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 47 ms
4,380 KB
testcase_29 AC 46 ms
4,380 KB
testcase_30 AC 47 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ld = double;
using C = complex<ld>;

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 C A = C{1 + v, -omega};
        const C a = pow(A, T);
        C g{gx - a.real(), gy + a.imag()};
        const ld l = hypot(1+v,omega);
        const ld F = (l == 1 ? T : (pow(l, 2 * T) - 1) / (l * l - 1));
        g /= F;
        vector<C> ans(T);
        ans[T - 1] = g;
        for (int i = T - 2; i >= 0; i--) {
            ans[i] = ans[i + 1] * A;
        }
        for (int i = 0; i < T; i++) {
            cout << fixed << setprecision(50) << ans[i].real() << " " << ans[i].imag() << endl;
        }
    }
    return 0;
}

0