結果
問題 |
No.894 二種類のバス
|
ユーザー |
![]() |
提出日時 | 2019-10-28 17:43:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 413 bytes |
コンパイル時間 | 1,506 ms |
コンパイル使用メモリ | 165,680 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-09-14 21:15:12 |
合計ジャッジ時間 | 2,370 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 1 |
ソースコード
#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; ll lcm = a/gcd(a,b)*b; --t; ans += t/a + t/b - t/lcm ; cout << ans << endl; return 0; }