結果

問題 No.760 Where am I moved to?
ユーザー chocoruskchocorusk
提出日時 2018-12-08 00:28:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,704 bytes
コンパイル時間 864 ms
コンパイル使用メモリ 94,392 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-02 11:59:56
合計ジャッジ時間 2,999 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#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;
}
0