結果

問題 No.415 ぴょん
ユーザー alpha_virginis
提出日時 2016-08-27 16:42:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 380 bytes
コンパイル時間 1,529 ms
コンパイル使用メモリ 166,408 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-18 14:43:37
合計ジャッジ時間 2,098 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

namespace Math {
  static uint64_t gcd(uint64_t x, uint64_t y) {
    while( y != 0 ) {
      x %= y;
      std::swap(x, y);
    }
    return x;
  }
  static uint64_t lcm(uint64_t x, uint64_t y) {
    return x / gcd(x, y) * y;
  }
};

int main() {
  uint64_t x, y;
  scanf("%lu %lu", &x, &y);
  printf("%lu\n", x / Math::gcd(x, y) - 1);
  
  return 0;
}

0