結果
問題 | No.3020 ユークリッドの互除法・改 |
ユーザー |
![]() |
提出日時 | 2025-02-14 21:25:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 507 bytes |
コンパイル時間 | 3,935 ms |
コンパイル使用メモリ | 249,912 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-02-14 21:25:28 |
合計ジャッジ時間 | 4,858 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <stdio.h>#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;using mint = modint998244353;#define rep(i,n) for (int i = 0; i < (n); ++i)#define Inf32 1000000000#define Inf64 1000000000000000001LLint main(){long long a,b,c,d;cin>>a>>b>>c>>d;long long g = gcd(abs(a),abs(b));g = gcd(g,abs(c));g = gcd(g,abs(d));long long t = a * d - b * c;t = abs(t);long long x;if(g==0)x = 0;else x = t / g;cout<<g<<' '<<x<<endl;return 0;}