結果
| 問題 | No.3020 ユークリッドの互除法・改 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-14 21:51:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 431 bytes |
| コンパイル時間 | 1,437 ms |
| コンパイル使用メモリ | 159,756 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-02-14 21:53:29 |
| 合計ジャッジ時間 | 2,296 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll A[2][2];
int main() {
ll d = 0;
for (int i = 0; i < 2; i ++)
for (int j = 0; j < 2; j ++) {
cin >> A[i][j];
d = __gcd(d, abs(A[i][j]));
}
ll det = A[0][0] * A[1][1] - A[0][1] * A[1][0];
det = abs(det);
if (d == 0) {
printf("0 0");
} else {
printf("%lld %lld", d, det / d);
}
}