結果

問題 No.61 リベリオン
ユーザー testestesttestestest
提出日時 2016-07-30 09:49:43
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 691 ms / 5,000 ms
コード長 348 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 20,864 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 17:20:17
合計ジャッジ時間 2,396 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 691 ms
5,376 KB
testcase_04 AC 680 ms
5,376 KB
testcase_05 AC 0 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘w’ [-Wimplicit-int]
main.c:1:3: warning: type defaults to ‘int’ in declaration of ‘h’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |   ^
main.c:1:5: warning: type defaults to ‘int’ in declaration of ‘mx’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |     ^~
main.c:1:8: warning: type defaults to ‘int’ in declaration of ‘my’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |        ^~
main.c:1:11: warning: type defaults to ‘int’ in declaration of ‘hx’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |           ^~
main.c:1:14: warning: type defaults to ‘int’ in declaration of ‘hy’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |              ^~
main.c:1:17: warning: type defaults to ‘int’ in declaration of ‘vx’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |                 ^~
main.c:1:20: warning: type defaults to ‘int’ in declaration of ‘vy’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |                    ^~
main.c:1:23: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |                       ^
main.c:1:25: warning: type defaults to ‘int’ in declaration of ‘g’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |                         ^
main.c:1:27: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
    1 | w,h,mx,my,hx,hy,vx,vy,d,g,i;
      |                           ^
main.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | check(x,y){x%=2*w;y%=2*h;return (x==mx)|(2*w-x==mx)&&(y==my)|(2*h-y==my);}
      | ^~~~~
main.c: In function ‘check’:
main.c:2:1: warning: type of ‘x’ defaults to ‘

ソースコード

diff #

w,h,mx,my,hx,hy,vx,vy,d,g,i;
check(x,y){x%=2*w;y%=2*h;return (x==mx)|(2*w-x==mx)&&(y==my)|(2*h-y==my);}
gcd(p,q){return q?gcd(q,p%q):p;}
main(){
	gets(&i);
	for(;~scanf("%d%d%d%d%d%d%d%d%d",&w,&h,&d,&mx,&my,&hx,&hy,&vx,&vy);){
		g=abs(gcd(vx,vy));
		for(i=0;i<2e4&&!check(abs(hx+vx/g*i),abs(hy+vy/g*i));i++);
		puts(i>d*g|i==2e4?"Miss":"Hit");
	}
}
0