結果

問題 No.3020 ユークリッドの互除法・改
ユーザー t98slider
提出日時 2025-02-14 21:34:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 755 bytes
コンパイル時間 1,805 ms
コンパイル使用メモリ 198,408 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-02-14 21:36:42
合計ジャッジ時間 2,652 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other AC * 1 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template<class T> istream& operator >> (istream& is, vector<T>& vec) {
    for(T& x : vec) is >> x;
    return is;
}

template<class T> ostream& operator << (ostream& os, const vector<T>& vec) {
    if(vec.empty()) return os;
    os << vec[0];
    for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it;
    return os;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector A(2, vector<ll>(2));
    cin >> A;
    ll g = gcd(A[0][0], A[0][1]);
    g = gcd(g, gcd(A[1][0], A[1][1]));
    ll d = abs(A[0][0] * A[1][1] - A[1][0] * A[0][1]);
    if(g == 0){
        cout << 0 << " " << 0 << '\n';
        return 0;
    }
    cerr << g << " " << d / g << '\n';
}
0