結果

問題 No.141 魔法少女コバ
ユーザー alpha_virginis
提出日時 2016-01-16 14:13:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 335 bytes
コンパイル時間 1,213 ms
コンパイル使用メモリ 158,368 KB
実行使用メモリ 9,884 KB
最終ジャッジ日時 2024-09-19 19:57:25
合計ジャッジ時間 13,474 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 92
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int solve(int a, int b) {
  int res = 0;
  while( a != 0 ) {
    if( a < b ) {
      std::swap(a, b); res += 1;
    }
    if( a > b ) {
      res += a / b;
      a %= b;
    }
  }
  return res - 1; 
}

int main() {

  int A, B;
  std::cin >> A >> B;

  std::cout << solve(A, B) << std::endl;
  
  return 0;
}
0