結果
| 問題 |
No.3020 ユークリッドの互除法・改
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-14 21:33:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 676 bytes |
| コンパイル時間 | 1,894 ms |
| コンパイル使用メモリ | 198,388 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-02-14 21:34:00 |
| 合計ジャッジ時間 | 2,884 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 RE * 1 |
ソースコード
#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]);
cout << g << " " << d / g << '\n';
}