結果
問題 | No.894 二種類のバス |
ユーザー |
![]() |
提出日時 | 2019-10-28 20:32:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 428 bytes |
コンパイル時間 | 1,538 ms |
コンパイル使用メモリ | 165,916 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 21:17:21 |
合計ジャッジ時間 | 2,285 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> VI; typedef vector<ll> VLL; ll gcd(ll a, ll b){ if(a%b == 0){ return b; }else{ return gcd(b, a%b); } } int main(){ ll t,a,b,ans = 1; cin >> t >> a >> b; unsigned long long lcm = a/gcd(a,b)*b; --t; ans += t/a + t/b - t/lcm; cout << ans << endl; return 0; }