結果
| 問題 |
No.141 魔法少女コバ
|
| コンテスト | |
| ユーザー |
mencotton
|
| 提出日時 | 2020-11-02 23:13:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 371 bytes |
| コンパイル時間 | 650 ms |
| コンパイル使用メモリ | 69,080 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-22 08:17:42 |
| 合計ジャッジ時間 | 3,153 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 93 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
int func(int m, int n) {
if (n == 1)return m - 1;
if (m < n)return 1 + func(n, m);
return m / n + func(m % n, n);
}
int main() {
int m, n;
cin >> m >> n;
int x = __gcd(m, n);
m /= x, n /= x;
cout << func(m, n) << endl;
return 0;
}
mencotton