結果
| 問題 |
No.894 二種類のバス
|
| コンテスト | |
| ユーザー |
n0ma_ru
|
| 提出日時 | 2024-04-10 12:59:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 726 bytes |
| コンパイル時間 | 1,992 ms |
| コンパイル使用メモリ | 191,932 KB |
| 最終ジャッジ日時 | 2025-02-20 23:40:58 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(v) v.begin(),v.end()
#define dbg(x) cerr << #x << ": " << (x) << endl;
template<class F, class S>
ostream& operator<<(ostream& os, pair<F,S>& p) {
os << '(' << p.first << ',' << p.second << ')';
return os;
}
template<class Iter>
void print(Iter beg, Iter end) {
for (Iter itr = beg; itr != end; ++itr) {
cerr << *itr << ' ';
}
cerr << '\n';
}
ll t,a,b;
ll lcm(ll x, ll y) {
return x / gcd(x,y) * y;
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> t >> a >> b;
--t;
ll ans = t / a + 1;
ans += t / b + 1;
ans -= t / lcm(a,b) + 1;
cout << ans << '\n';
}
n0ma_ru