結果
問題 | No.471 直列回転機 |
ユーザー | Yamyuki |
提出日時 | 2016-12-21 14:40:59 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,033 bytes |
コンパイル時間 | 575 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 39,056 KB |
平均クエリ数 | 0.10 |
最終ジャッジ日時 | 2024-07-16 11:49:35 |
合計ジャッジ時間 | 5,601 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | TLE * 1 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:30:25: warning: format ‘%d’ expects argument of type ‘int *’, but argument 2 has type ‘long int *’ [-Wformat=] 30 | scanf("%d %d",&x[i],&y[i]); | ~^ ~~~~~ | | | | int * long int * | %ld main.c:30:28: warning: format ‘%d’ expects argument of type ‘int *’, but argument 3 has type ‘long int *’ [-Wformat=] 30 | scanf("%d %d",&x[i],&y[i]); | ~^ ~~~~~ | | | | int * long int * | %ld main.c:33:28: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=] 33 | printf("? %d %d\n",x[0],y[0]); | ~^ ~~~~ | | | | int long int | %ld main.c:33:31: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=] 33 | printf("? %d %d\n",x[0],y[0]); | ~^ ~~~~ | | | | int long int | %ld main.c:28:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 28 | scanf("%ld",&m); | ^~~~~~~~~~~~~~~ main.c:30:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 30 | scanf("%d %d",&x[i],&y[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:35:17: warning: ignoring return value of ‘scanf’ declared with at
ソースコード
#include<stdio.h> long x[50000],y[50000]; void roll(long i,long* xl,long* yl,int r){ long h,hx=xl[i]-xl[0],hy=yl[i]-yl[0]; switch(r){ case 3: h=hy; hy=hx; hx=-h; case 2: h=hy; hy=hx; hx=-h; case 1: h=hy; hy=hx; hx=-h; case 0: xl[i]=xl[0]+hx; yl[i]=yl[0]+hy; return; } } int main(){ long m,i,dx,dy,x1,x2,y1,y2; int r; scanf("%ld",&m); for(i=0;i<m;i++){ scanf("%d %d",&x[i],&y[i]); } if(m==1){ printf("? %d %d\n",x[0],y[0]); fflush(stdout); scanf("%ld %ld",&x[0],&y[0]); }else{ printf("? %ld %ld\n",x[0],y[0]); fflush(stdout); scanf("%ld %ld",&x1,&y1); dx=x1-x[0]; dy=y1-y[0]; printf("? %ld %ld\n",x[1],y[1]); fflush(stdout); scanf("%ld %ld",&x2,&y2); x2=x2-x1; y2=y2-y1; for(i=0;!(x2==x[1]-x[0]) || !(y2==y[1]-y[0]);i++){ r=x2; x2=-y2; y2=r; } r=i; for(i=1;i<m;i++){ roll(i,x,y,r); x[i]+=dx; y[i]+=dy; } x[0]+=dx; y[0]+=dy; } printf("!\n"); for(i=0;i<m;i++){ printf("%ld %ld\n",x[i],y[i]); } fflush(stdout); return 0; }