結果

問題 No.894 二種類のバス
ユーザー junsui
提出日時 2019-09-29 15:59:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 40,768 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-03 04:29:23
合計ジャッジ時間 978 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)

typedef long long int ll;

int main( void ){
	ll n, a, b;
	if (!scanf( "%lld %lld %lld", &n, &a, &b ))
		return 0;
	ll sum = 0;
	n--;
	sum += n / a + n / b + 2;
	ll gcd = std::__gcd( a, b );
	sum -= (n-1)/(a * b / std::__gcd( a, b ))+1;
	printf( "%lld\n", sum );
	return 0;
}
0