結果
| 問題 |
No.1936 Rational Approximation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-13 21:37:07 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 575 bytes |
| コンパイル時間 | 2,999 ms |
| コンパイル使用メモリ | 242,472 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 01:10:18 |
| 合計ジャッジ時間 | 3,508 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int gcdExtended(int a, int b, int *x, int *y)
{
// Base Case
if (a == 0)
{
*x = 0;
*y = 1;
return b;
}
int x1, y1; // To store results of recursive call
int gcd = gcdExtended(b % a, a, &x1, &y1);
// Update x and y using results of
// recursive call
*x = y1 - (b / a) * x1;
*y = x1;
return gcd;
}
int main()
{
int a, b, x, y;
scanf("%d%d", &a, &b);
printf("%d\n", a+b);
//gcdExtended(a, b, &x, &y);
//cout << abs(y) << abs(x) << endl;
}