結果

問題 No.894 二種類のバス
ユーザー watasihakodama
提出日時 2019-09-29 23:23:10
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 788 bytes
コンパイル時間 1,077 ms
コンパイル使用メモリ 140,592 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 15:01:24
合計ジャッジ時間 1,863 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

long long lcm(long long a,long long b){
	return a*b/gcd(a,b);
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	long long T,A,B;
	cin>>T>>A>>B;
	long long l=lcm(A,B);
	cout<<(T-1)/A + (T-1)/B -(T-1)/l+1<<endl;
}

	
0