結果
| 問題 |
No.894 二種類のバス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-29 16:11:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 361 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 34,016 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-03 04:30:07 |
| 合計ジャッジ時間 | 718 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#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 * gcd / a / b ) + 1;
printf( "%lld\n", sum );
return 0;
}