結果
| 問題 | 
                            No.894 二種類のバス
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-12-18 00:24:14 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 366 bytes | 
| コンパイル時間 | 2,000 ms | 
| コンパイル使用メモリ | 192,484 KB | 
| 最終ジャッジ日時 | 2025-01-27 02:45:51 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 5 WA * 12 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:11: warning: ‘l’ may be used uninitialized [-Wmaybe-uninitialized]
   18 |   ans -= t/l;
      |          ~^~
main.cpp:16:6: note: ‘l’ was declared here
   16 |   ll l;
      |      ^
            
            ソースコード
#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;
}