結果

問題 No.894 二種類のバス
ユーザー ForestedForested
提出日時 2020-05-26 13:57:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 728 ms
コンパイル使用メモリ 90,572 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 04:16:31
合計ジャッジ時間 1,382 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

long long GCD(long long A, long long B) {if (A % B) return GCD(B, A % B); return B;}
long long LCM(long long A, long long B) {return A / GCD(A, B) * B;}

int main() {
    long long T, A, B;
    cin >> T >> A >> B;
    cout << (T + A - 1) / A + (T + B - 1) / B - (T + LCM(A, B) - 1) / LCM(A, B) << endl;
}
0