結果
問題 | No.760 Where am I moved to? |
ユーザー |
![]() |
提出日時 | 2018-12-08 00:28:28 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,704 bytes |
コンパイル時間 | 831 ms |
コンパイル使用メモリ | 96,980 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 07:09:52 |
合計ジャッジ時間 | 7,748 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <cstdio>#include <cstring>#include <iostream>#include <string>#include <cmath>#include <bitset>#include <vector>#include <map>#include <set>#include <queue>#include <deque>#include <algorithm>#include <complex>#include <unordered_map>#include <unordered_set>#include <random>using namespace std;typedef long long int ll;//typedef pair<int, int> P;const double PI=acos(-1.0);const double EPS=1e-10;double add(double a, double b){if(abs(a+b)<EPS*(abs(a)+abs(b))) return 0;return a+b;}struct P{double x, y;P() {}P(double x, double y): x(x), y(y){}P operator+ (P p){return P(add(x, p.x), add(y, p.y));}P operator- (P p){return P(add(x, -p.x), add(y, -p.y));}P operator* (double d){return P(x*d, y*d);}double dot(P p){return add(x*p.x, y*p.y);}double det(P p){return add(x*p.y, -y*p.x);}bool operator< (const P& p) const{if(abs(x-p.x)>EPS){return x<p.x;}else{return y<p.y-EPS;}}};double atan(P p){return atan2(p.y, p.x);}P rot(P p, double t){return P(p.x*cos(t)-p.y*sin(t), p.x*sin(t)+p.y*cos(t));}int main(){double xa, ya, ta;cin>>xa>>ya>>ta;ta=ta/180*PI;P p0=P(xa, ya);double x11, y11, x12, y12, x21, y21, x22, y22;cin>>x11>>y11>>x12>>y12>>x21>>y21>>x22>>y22;P p1=P(x11, y11), p2=P(x12, y12), q1=P(x21, y21), q2=P(x22, y22);double t=atan(p2-p1)-atan(q2-q1);double tb=ta+t;if(tb<0){while(tb<0) tb+=(2*PI);}else if(tb>=2*PI){while(tb>=2*PI) tb-=(2*PI);}P q0=p1-rot(q1-p0, t);printf("%.3lf %.3lf %.3lf\n", q0.x, q0.y, tb/PI*180);return 0;}