結果
問題 |
No.1936 Rational Approximation
|
ユーザー |
![]() |
提出日時 | 2022-05-13 22:03:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 900 bytes |
コンパイル時間 | 712 ms |
コンパイル使用メモリ | 74,892 KB |
最終ジャッジ日時 | 2025-01-29 07:00:58 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 13 |
ソースコード
#include <iostream> #include <vector> #include <queue> #include <cassert> #include <algorithm> using namespace std; // using namespace atcoder; typedef long long ll; typedef long double ld; const ll INF = 1LL << 60; const ll MOD = 998244353; // using mint = modint998244353; const string NEW_LINE = "\n"; inline void output_YesNo(bool x) { cout << (x ? "Yes" : "No") << endl; } template<typename T> inline void chmax(T &lhs, const T &rhs) { lhs = max(lhs, rhs); } template<typename T> inline void chmin(T &lhs, const T &rhs) { lhs = min(lhs, rhs); } // #include <iomanip> // // void init_output() { cout << fixed << setprecision(15); } int main() { ll p, q; cin >> p >> q; ll pl = p - 1, ql = q - 1, pr = p, qr = q - 1; { ll x = __gcd(pl, ql), y = __gcd(pr, qr); pl /= x, ql /= x, pr /= y, qr /= y; } cout << pl + ql + pr + qr << endl; return 0; }