結果

問題 No.1794 Continued Fraction
ユーザー t98slidert98slider
提出日時 2023-04-19 21:43:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 447 bytes
コンパイル時間 1,634 ms
コンパイル使用メモリ 166,380 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-23 01:09:22
合計ジャッジ時間 5,199 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 RE -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 1 ms
5,376 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 RE -
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 2 ms
5,376 KB
testcase_24 RE -
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 RE -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m;
    cin >> n >> m;
    vector<ll> ans;
    function<void(ll, ll)> rec = [&](ll A, ll B){
        if(A == 1) return;
        ans.emplace_back(A / B);
        rec(B, A % B);
    };
    rec(n, m);
    for(int i = 0; i < ans.size(); i++){
        cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' ');
    }
}
0