結果
問題 |
No.894 二種類のバス
|
ユーザー |
![]() |
提出日時 | 2019-09-27 21:40:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 564 bytes |
コンパイル時間 | 1,496 ms |
コンパイル使用メモリ | 167,200 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-24 21:01:41 |
合計ジャッジ時間 | 2,142 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 WA * 6 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,a) for(int i = 0; i < (a); i++) #define ALL(a) (a).begin(),(a).end() typedef long long ll; typedef pair<int, int> P; const int INF = 1e9; const int MOD = 1e9 + 7; long long GCD(long long m,long long n){ if(n == 0) return m; else return GCD(n,m % n); } long long LCM(long long m,long long n){ long long g = GCD(m,n); return m / g * n; } signed main(){ ll t,a,b; cin >> t >> a >> b; ll c = LCM(a, b); cout << (t + a - 1) / a + (t + b - 1) / b - (t + c - 1) / c << endl; }