結果

問題 No.894 二種類のバス
ユーザー yassansann
提出日時 2019-09-27 22:20:06
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 158,136 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 17:36:04
合計ジャッジ時間 2,022 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long int gcd(long long int,long long int);

int main(){
	long long int T,A,B,C,ans=0;
	cin >> T >> A >> B;
	ans+=(T+A-1)/A;
	ans+=(T+B-1)/B;
	C=(A*B/(gcd(A,B)));
	ans-=(T+C-1)/C;
	cout << ans << endl;
	return 0;
}
long long int gcd(long long int a,long long int b){
	if(b==0){
		return a;
	}
	return gcd(b,a%b);
}
0