結果
問題 |
No.882 約数倍数
|
ユーザー |
![]() |
提出日時 | 2020-04-23 01:31:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 500 ms |
コード長 | 506 bytes |
コンパイル時間 | 1,676 ms |
コンパイル使用メモリ | 172,296 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 12:16:54 |
合計ジャッジ時間 | 2,359 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; vector<ll> divisor(ll n){ std::vector<ll> res; for(ll i = 1LL; i * i <= n; i++){ if(n % i == 0){ res.push_back(i); ll j = n / i; if(i != j)res.push_back(j); } } std::sort(res.begin(),res.end()); return res; } int main() { int a, b; cin >> a >> b; vector<ll> c = divisor(a); cout << (binary_search(c.begin(), c.end(), b) ? "YES" : "NO") << endl; }