結果

問題 No.894 二種類のバス
ユーザー bonKotsubonKotsu
提出日時 2021-12-18 00:24:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 366 bytes
コンパイル時間 1,893 ms
コンパイル使用メモリ 198,280 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-10-13 03:54:00
合計ジャッジ時間 4,586 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,372 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,352 KB
testcase_16 RE -
testcase_17 AC 1 ms
4,352 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:18:11: 警告: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
   18 |   ans -= t/l;
      |          ~^~
main.cpp:16:6: 備考: ‘l’ はここで定義されています
   16 |   ll l;
      |      ^

ソースコード

diff #

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

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define LP pair<ll, ll>

const ll INF = 1e18;

int main() {
  ll t, a, b;
  cin >> t >> a >> b;
  ll ans = t/a+t/b;
  ll g = gcd(a,b);
  ll l;
  if (a/g < INF/b) l = a/g*b;
  ans -= t/l;
  cout << ans << endl;


  return 0;
}
0