結果
| 問題 | No.61 リベリオン | 
| コンテスト | |
| ユーザー | 👑  testestest | 
| 提出日時 | 2016-07-30 09:49:43 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 630 ms / 5,000 ms | 
| コード長 | 348 bytes | 
| コンパイル時間 | 433 ms | 
| コンパイル使用メモリ | 20,992 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-13 16:15:06 | 
| 合計ジャッジ時間 | 2,067 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 4 | 
コンパイルメッセージ
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 ‘
            
            ソースコード
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");
	}
}
            
            
            
        