結果
| 問題 | No.61 リベリオン | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-06-14 10:12:13 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 572 bytes | 
| コンパイル時間 | 2,199 ms | 
| コンパイル使用メモリ | 192,144 KB | 
| 最終ジャッジ日時 | 2025-01-11 04:12:54 | 
| ジャッジサーバーID (参考情報) | judge5 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 3 WA * 1 | 
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
	int q; cin>>q;
	rep(_,q){
		int w,h,d,sx,sy,gx,gy,vx,vy;
		cin>>w>>h>>d>>gx>>gy>>sx>>sy>>vx>>vy;
		int g=gcd(vx,vy);
		d*=g;
		vx/=g;
		vy/=g;
		bool vis[30][30]={};
		int x=sx,y=sy;
		while(d>0 && !vis[y][x]){
			vis[y][x]=true;
			y=(y+vy)%(2*h); if(y<0) y+=2*h;
			x=(x+vx)%(2*w); if(x<0) x+=2*w;
			d--;
		}
		puts(vis[gy][gx]
		   ||vis[gy][(2*w-gx)%(2*w)]
		   ||vis[(2*h-gy)%(2*h)][gx]
		   ||vis[(2*h-gy)%(2*h)][(2*w-gx)%(2*w)]?"Hit":"Miss");
	}
	return 0;
}
            
            
            
        