結果

問題 No.894 二種類のバス
ユーザー yassansann
提出日時 2019-09-27 22:11:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 365 bytes
コンパイル時間 1,340 ms
コンパイル使用メモリ 159,916 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 16:04:45
合計ジャッジ時間 1,763 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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