結果
| 問題 |
No.1932 動く点 P / Moving Point P
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2022-05-10 21:05:26 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 324 ms / 6,000 ms |
| コード長 | 949 bytes |
| コンパイル時間 | 1,291 ms |
| コンパイル使用メモリ | 31,872 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 03:53:18 |
| 合計ジャッジ時間 | 16,230 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 11 |
コンパイルメッセージ
main.c: In function 'main':
main.c:33:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
33 | scanf("%ld",&n);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | #pragma GCC optimize("Ofast")
main.c:33:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
33 | scanf("%ld",&n);
| ^~~~~
main.c:33:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:42:17: warning: implicit declaration of function 'sincos' [-Wimplicit-function-declaration]
42 | sincos(PI/180*r,&s,&c);
| ^~~~~~
main.c:59:17: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
59 | printf("%f %f\n",a,b);
| ^~~~~~
main.c:59:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:59:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:59:17: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#define rep(v,e) for(long v=0;v<e;++v)
#define PI 3.14159265358979
typedef struct M{
double c,s,x,y;
}M;
static M compose(M a,M b){
M r;
r.c=b.c*a.c-b.s*a.s;
r.s=b.s*a.c+b.c*a.s;
r.x=a.c*b.x-a.s*b.y+a.x;
r.y=a.s*b.x+a.c*b.y+a.y;
return r;
}
static M invert(M a){
M r;
r.c=a.c;
r.s=-a.s;
r.x=-a.c*a.x-a.s*a.y;
r.y= a.s*a.x-a.c*a.y;
return r;
}
M ms[100001];
int main(){
long n;
scanf("%ld",&n);
ms[0].c=1;
ms[0].s=0;
ms[0].x=0;
ms[0].y=0;
rep(i,n){
double p,q,r;
scanf("%lf%lf%lf",&p,&q,&r);
double c,s;
sincos(PI/180*r,&s,&c);
M m;
m.c=c;
m.s=s;
m.x=(1-c)*p+s*q;
m.y=-s*p+(1-c)*q;
ms[i+1]=compose(m,ms[i]);
}
long q;
scanf("%ld",&q);
rep(j,q){
long s,t;
double x,y;
scanf("%ld%ld%lf%lf",&s,&t,&x,&y);
M m=compose(ms[t],invert(ms[s-1]));
double a=m.c*x-m.s*y+m.x;
double b=m.s*x+m.c*y+m.y;
printf("%f %f\n",a,b);
}
return 0;
}
tails