結果
問題 |
No.3020 ユークリッドの互除法・改
|
ユーザー |
|
提出日時 | 2025-02-14 21:49:47 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 426 bytes |
コンパイル時間 | 1,629 ms |
コンパイル使用メモリ | 159,812 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-02-14 21:50:23 |
合計ジャッジ時間 | 2,427 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 7 |
ソースコード
#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, 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); } }