結果

問題 No.61 リベリオン
ユーザー kyuridenamidakyuridenamida
提出日時 2016-02-18 02:53:03
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,660 bytes
コンパイル時間 1,476 ms
コンパイル使用メモリ 161,196 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 06:29:42
合計ジャッジ時間 8,069 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 3 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0 ; (i) < (int)(n) ; (i)++)
#define REP(i,a,b) for(int (i) = a ; (int)(i) <= (int)(b) ; (i)++)
#define all(n) (n).begin(),(n).end()
typedef long long ll;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<long long,long long> Pii;
typedef vector<Pii> VPii;

typedef complex<double> P;

int canDiv(int a,int b){
	if( b == 0 ) return a == 0;
	else return 1. * a / b >= 0;
}
int main(){
	int Q;
	cin >> Q;
	while(Q--){	
		int W,H,D,Mx,My,Hx,Hy,Vx,Vy;
		cin >> W >> H >> D >> Hx >> Hy >> Mx >> My >> Vx >> Vy;
		
		for(int i = -50 ; i < 50 ; i++){
			for(int j = -50 ; j < 50 ; j++){
				int ox = j * W;
				int oy = i * H;
				// int mx = j % 2 ? W - Mx;
				// int my = i % 2 ? H - My;
				int hx = (j % 2 ? W - Hx : Hx)+ox;
				int hy = (i % 2 ? H - Hy : Hy)+oy;
				
				// cout << (hx - Mx) % Vx << " " << (hy - My) % Vy << endl;
				// if(canDiv(hy-My,Vy)) cout << "OK" << canDiv(hx-Mx,Vx) << " " << canDiv(hy-My,Vy)  << "|" << hy-My << "|" << i << " " << j << endl;
				P I = P(hx,hy) - P(Mx,My);
				P V(Vx,Vy);
				if( abs(I)/abs(V) > D + 1e-4 ) continue;
				P IE = I / abs(I);
				P VE = V / abs(V);
				// cout << (I*conj(V)).imag() << endl;

				if( abs(IE-VE) <= 1e-9  ){
					// cout << abs(I)/abs(V) << "|" << D << " " << i << "|" << I << endl;
					// cout << I << "(" << P(hx,hy) << "(((" << i << " " << j << ")))" << "|||" << P(Mx,My) << "||||" << V << "|" << abs(I)/abs(V)  << endl;
				// cout << VE << " " << IE << "|" << abs(I)/abs(V) << "|" << D << endl;
					cout << "Hit" << endl;
					goto exit;
				}
			}
		}
		cout << "Miss" << endl;
		exit:;
	}
}
0