結果
問題 | No.1794 Continued Fraction |
ユーザー |
|
提出日時 | 2022-08-17 21:33:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 2,288 ms |
コンパイル使用メモリ | 195,600 KB |
最終ジャッジ日時 | 2025-01-30 23:32:21 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ll n,m; std::cin >> n>>m; vector<ll> ans; while(m!=0){ ans.push_back(n/m); ll tmp = m; m = n-m*ans.back(); n = tmp; } for (int i = 0; i < ans.size(); i++) { std::cout << ans[i]; if(i<ans.size()-1){ std::cout << " "; } } std::cout << std::endl; }