結果
問題 |
No.3152 neither multiple of A nor B
|
ユーザー |
|
提出日時 | 2025-05-20 22:03:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 430 bytes |
コンパイル時間 | 1,324 ms |
コンパイル使用メモリ | 162,580 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-20 22:03:32 |
合計ジャッジ時間 | 2,439 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; #define REP(i,n) for(ll i=0;i<ll(n);i++) ll g(ll a,ll b){ if(b==0) return a; else return g(b,a%b); } ll f(ll a,ll b){ return a/g(a,b)*b; } int main(void){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll i,j; ll N,A,B; cin >> N >> A >> B; cout << N-N/A-N/B+N/f(A,B) << endl; return 0; }