結果
問題 |
No.894 二種類のバス
|
ユーザー |
|
提出日時 | 2019-11-17 15:44:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 384 bytes |
コンパイル時間 | 1,513 ms |
コンパイル使用メモリ | 166,392 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 05:58:22 |
合計ジャッジ時間 | 2,282 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 1 |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll gcd(ll a,ll b){ if(b==0){ return a; } return gcd(b,a%b); } int main(){ ll t,a,b;cin >> t >> a >> b; if(t==1){ if(a==1||b==1){ cout << 2 << endl; } else{ cout << 1 << endl; } return 0; } t--; ll c=a/gcd(a,b)*b; cout << t/a+t/b-t/c+1 << endl; }