結果

問題 No.894 二種類のバス
ユーザー yuji9511yuji9511
提出日時 2019-09-27 21:39:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 851 bytes
コンパイル時間 1,371 ms
コンパイル使用メモリ 159,620 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-25 02:04:12
合計ジャッジ時間 2,011 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
void print() {}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail){ cout << head << " \n"[sizeof...(tail) == 0]; print(forward<Tail>(tail)...);}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll T,A,B;
	cin >> T >> A >> B;
	ll ans = (T+A-1) / A + (T+B-1) / B;
	double d = (double) A * (double) B;
	if(d <= 9e18){
		ans -= (T + lcm(A,B)-1) / lcm(A,B);
	}
	print(ans);
	
}
0