結果

問題 No.141 魔法少女コバ
ユーザー dazy
提出日時 2018-06-14 19:26:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 477 bytes
コンパイル時間 1,248 ms
コンパイル使用メモリ 159,568 KB
実行使用メモリ 16,704 KB
最終ジャッジ日時 2024-06-30 14:28:49
合計ジャッジ時間 13,652 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 92
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define print(x) cout << x << "\n"

int main() {
    fastcin;
    int m, n, g, ans = 0;
    cin >> m >> n;
    while(n!=1) {
        if(m>n) {
            ans += m/n;
            m %= n;
        } else {
            swap(m, n);
            ans++;
        }
    }
    ans += m-1;
    print(ans);
    return 0;
}
0