結果

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

ソースコード

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 / a / b * std::__gcd( a, b )) + 1;
	printf( "%lld\n", sum );
	return 0;
}
0