結果

問題 No.3180 angles sum
ユーザー SnowBeenDiding
提出日時 2025-06-13 21:42:05
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,129 bytes
コンパイル時間 5,195 ms
コンパイル使用メモリ 335,368 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-13 21:42:17
合計ジャッジ時間 10,930 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;

typedef long long ll;

using mint = modint998244353;

struct fraction {
    ll p, q;
    fraction(ll P = 0, ll Q = 1) : p(P), q(Q) {
        ll g = gcd(p, q);
        p /= g;
        q /= g;
    }
    bool operator<(const fraction &other) const {
        return p * other.q < other.p * q;
    }
    bool operator<=(const fraction &other) const {
        return p * other.q <= other.p * q;
    }
    bool operator>(const fraction &other) const {
        return p * other.q > other.p * q;
    }
    bool operator>=(const fraction &other) const {
        return p * other.q >= other.p * q;
    }
    bool operator==(const fraction &other) const {
        return p * other.q == other.p * q;
    }

    fraction operator+(const fraction &other) const {
        return fraction(p * other.q + other.p * q, q * other.q);
    }
    fraction operator-(const fraction &other) const {
        return fraction(p * other.q - other.p * q, q * other.q);
    }
    fraction operator*(const fraction &other) const {
        return fraction(p * other.p, q * other.q);
    }
    fraction operator/(const fraction &other) const {
        return fraction(p * other.q, q * other.p);
    }
    fraction operator+=(const fraction &other) { return *this = *this + other; }
    fraction operator-=(const fraction &other) { return *this = *this - other; }
    fraction operator*=(const fraction &other) { return *this = *this * other; }
    fraction operator/=(const fraction &other) { return *this = *this / other; }
};

fraction input() {
    ll x, y;
    cin >> x >> y;
    fraction ret(y, x);
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(12);
    int t;
    cin >> t;
    fraction one(1, 1);
    while (t--) {
        auto A = input();
        auto B = input();
        auto C = input();
        fraction AB = A + B;
        AB /= (one - A * B);
        bool ok = AB == C;
        cout << (ok ? "Yes\n" : "No\n");
    }
}
0