結果
問題 |
No.61 リベリオン
|
ユーザー |
![]() |
提出日時 | 2022-12-20 18:06:36 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,047 bytes |
コンパイル時間 | 954 ms |
コンパイル使用メモリ | 142,568 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-18 01:57:15 |
合計ジャッジ時間 | 1,783 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 3 WA * 1 |
ソースコード
#include <iostream> #include <vector> #include <cmath> #include <map> #include <set> #include <iomanip> #include <queue> #include <algorithm> #include <numeric> #include <deque> #include <complex> using namespace std; int main(){ long long Q, W, H, D, mx, my, hx, hy, vx, vy, t, X, Y; cin >> Q; while(Q){ cin >> W >> H >> D >> mx >> my >> hx >> hy >> vx >> vy; t = min(D+1, 1025LL); long long g; if (vx == 0) g = abs(vy); else if (vy == 0) g = abs(vx); else g = gcd(vx, vy); D *= g; vx /= g; vy /= g; bool f=1; for (int i=0; i<t; i++){ X = ((hx + vx * i) % (W*2) + W*2) % (W*2); Y = ((hy + vy * i) % (H*2) + H*2) % (H*2); if (X > W) X = W * 2 - X; if (Y > H) Y = H * 2 - Y; if (mx == X && my == Y){ cout << "Hit" << endl; f = 0; break; } } if (f) cout << "Miss" << endl; Q--; } return 0; }