結果

問題 No.760 Where am I moved to?
ユーザー りあんりあん
提出日時 2018-12-08 01:24:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,015 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 199,288 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 04:06:52
合計ジャッジ時間 4,451 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
// using P = pair<int, int>;
const int M = 1000000007;

using P = complex<long double>;

int main() {
    long double xa, ya, ta, x11, y11, x12, y12, x21, y21, x22, y22;
    cin >> xa >> ya >> ta >> x11 >> y11 >> x12 >> y12 >> x21 >> y21 >> x22 >> y22;
    P a = P(xa, ya);
    P p11 = P(x11, y11);
    P p12 = P(x12, y12);
    P p21 = P(x21, y21);
    P p22 = P(x22, y22);
    P v = p12 - p11;
    P v1 = p21 - a;
    P v2 = p22 - a;
    long double d = abs(v);
    long double l1 = abs(v1);
    long double l2 = abs(v2);
    long double dar = arg(v2) - arg(v1);
    if (dar < 0) dar += M_PI * 2;
    long double ct = (d * d + l1 * l1 - l2 * l2) / (2 * d * l1);
    P p = dar < M_PI ? p11 + v * P(ct, sqrtl(1 - ct * ct)) / d * l1 : p11 + v / P(ct, sqrtl(1 - ct * ct)) / d * l1;
    long double t = ta - arg((p22 - p21) / v) / M_PI * 180;
    if (t < 0) t += 360;
    cout << setprecision(9);
    cout << p.real() << " " << p.imag() << " " << t << "\n";
    return 0;
}
0