結果
| 問題 |
No.61 リベリオン
|
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-03-19 13:07:06 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,122 bytes |
| コンパイル時間 | 633 ms |
| コンパイル使用メモリ | 60,960 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-01 09:13:33 |
| 合計ジャッジ時間 | 1,200 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 3 WA * 1 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8
typedef long long ll;
int gcd(int a, int b) {
return (b == 0) ? a : gcd(b,a%b);
}
int main() {
int i, j, q;
cin >> q;
rep (i,q) {
int w, h, d, mx, my, hx, hy, vx, vy;
int x, y, gcdxy;
cin >> w >> h >> d >> mx >> my >> hx >> hy >> vx >> vy;
x = hx; y = hy;
gcdxy = gcd(abs(vx),abs(vy));
vx = vx / gcdxy;
vy = vy / gcdxy;
for (j = -1; j < min(1000,d*gcdxy) && (x != mx || y != my); j++) {
x += vx + 30*w; y += vy + 30*h;
x %= 2*w; y %= 2*h;
if (x > w) {
x = 2*w - x;
vx = -vx;
}
if (y > h) {
y = 2*h - y;
vy = -vy;
}
}
if (j != min(1000,d))
cout << "Hit" << endl;
else
cout << "Miss" << endl;
}
return 0;
}
h_noson