結果

問題 No.894 二種類のバス
ユーザー bonKotsu
提出日時 2021-12-18 00:25:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 192,112 KB
最終ジャッジ日時 2025-01-27 02:45:59
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 5 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define LP pair<ll, ll>

const ll INF = 1e18;

int main() {
  ll t, a, b;
  cin >> t >> a >> b;
  ll ans = t/a+t/b;
  ll g = gcd(a,b);
  if (a/g < INF/b) {
    ll l = a/g*b;
    ans -= t/l;
  } else {
    ans--;
  }
  cout << ans << endl;


  return 0;
}
0