結果

問題 No.61 リベリオン
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2022-12-20 18:06:36
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,047 bytes
コンパイル時間 1,071 ms
コンパイル使用メモリ 141,416 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-29 02:52:45
合計ジャッジ時間 2,116 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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;
}
0