結果

問題 No.1794 Continued Fraction
ユーザー t98slider
提出日時 2023-04-19 21:43:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 447 bytes
コンパイル時間 1,718 ms
コンパイル使用メモリ 169,896 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-15 00:21:48
合計ジャッジ時間 6,780 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 3 RE * 11
権限があれば一括ダウンロードができます

ソースコード

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