結果
問題 | No.760 Where am I moved to? |
ユーザー |
![]() |
提出日時 | 2019-08-18 12:39:44 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 1,728 bytes |
コンパイル時間 | 373 ms |
コンパイル使用メモリ | 33,280 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 15:53:11 |
合計ジャッジ時間 | 8,506 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
コンパイルメッセージ
main.c: In function 'getdbl': main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration] 8 | #define gc() getchar_unlocked() | ^~~~~~~~~~~~~~~~ main.c:16:24: note: in expansion of macro 'gc' 16 | int n = 0, c = gc(); | ^~
ソースコード
// yukicoder: No.760 Where am I moved to?// bal4u 2019.8.18#include <stdio.h>#include <math.h>#if 1#define gc() getchar_unlocked()#else#define gc() getchar()#endifdouble getdbl() { // 実数の入力int minus = 0;double x, y;int n = 0, c = gc();if (c == '-') minus = 1, c = gc();do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');if (c == '.') {x = 0;y = 1, c = gc();do y *= 0.1, x += y * (c & 0xf), c = gc(); while (c >= '0');x += n;} else x = n;if (minus) x = -x;return x;}#define PI 3.1415926535897932384626433832795#define EPS 1e-13typedef struct { double x, y; } PP;PP vadd(PP p1, PP p2) { PP r; r.x = p1.x + p2.x, r.y = p1.y + p2.y; return r; }PP vsub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }PP vsmul(PP p, double k) { PP r; r.x = p.x * k, r.y = p.y * k; return r; }double dist(PP p1, PP p2) { return hypot(p1.x-p2.x, p1.y-p2.y); }double cross(PP a, PP b) { return a.x * b.y - a.y * b.x; }double dot(PP a, PP b) { return a.x * b.x + a.y * b.y; }double norm(PP a) { return a.x * a.x + a.y * a.y; }PP rot(PP a, double delta) {PP r;r.x = a.x*cos(delta) - a.y*sin(delta);r.y = a.x*sin(delta) + a.y*cos(delta);return r;}int main(){double da, db, d;PP pa, pb, p11, p12, p21, p22, p1, p2;pa.x = getdbl(), pa.y = getdbl(), da = getdbl()/180*PI;p11.x = getdbl(), p11.y = getdbl();p12.x = getdbl(), p12.y = getdbl();p21.x = getdbl(), p21.y = getdbl();p22.x = getdbl(), p22.y = getdbl();p1 = vsub(p12, p11), p2 = vsub(p22, p21);d = atan2(p1.y, p1.x) - atan2(p2.y, p2.x);db = da + d;pb = vsub(p11, rot(vsub(p21, pa), d));printf("%.12lf %.12lf %.12lf\n", pb.x+EPS, pb.y+EPS, db/PI*180+EPS);return 0;}