結果
問題 | No.760 Where am I moved to? |
ユーザー |
![]() |
提出日時 | 2018-12-08 01:24:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,015 bytes |
コンパイル時間 | 1,837 ms |
コンパイル使用メモリ | 195,316 KB |
最終ジャッジ日時 | 2025-01-06 18:41:15 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#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;}