結果

問題 No.894 二種類のバス
ユーザー veqcc
提出日時 2019-09-27 21:48:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 622 bytes
コンパイル時間 849 ms
コンパイル使用メモリ 102,180 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 22:48:29
合計ジャッジ時間 1,517 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll t, a, b;
    cin >> t >> a >> b;

    ll g = gcd(a, b);

    cout << 1 + (t-1)/a + (t-1)/b - ((t-1)/b)/(a/g) << "\n";
    return 0;
}
0