結果

問題 No.141 魔法少女コバ
ユーザー Navier_Boltzmann
提出日時 2023-12-31 14:06:57
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 703 ms / 5,000 ms
コード長 464 bytes
コンパイル時間 4,700 ms
コンパイル使用メモリ 308,768 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-27 17:05:49
合計ジャッジ時間 10,470 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 93
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>


using namespace std;
using namespace atcoder;
#define rep(i,m,n) for (int i = (int)(m); i < (int)(n); i++)
#define ll long long

int main(){

    ll M,N;
    cin >> M >> N;
    ll g;
    g = gcd(M,N);
    M /= g;
    N /= g;
    ll ans = 0;
    while (M!=N){
        if(M<N){
            swap(M,N);
            ans += 1;
        };
        M -= N;
        ans += 1;
    };
    cout << ans << endl;
    return 0;

}
0