結果
問題 | No.882 約数倍数 |
ユーザー |
![]() |
提出日時 | 2019-09-13 21:24:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 500 ms |
コード長 | 1,305 bytes |
コンパイル時間 | 2,341 ms |
コンパイル使用メモリ | 198,636 KB |
最終ジャッジ日時 | 2025-01-07 17:43:16 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
コンパイルメッセージ
main.cpp:30:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 30 | main(){ | ^~~~
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(ll i=0;i<(n);++i) #define reps(i,n) for(ll i=1;i<=(n);++i) using ll = long long; using str = string; constexpr long long INF = (1LL<<60); constexpr long long MOD = (1e9+7); template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));} template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;} template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;} template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} inline void dump(){cout<<endl;} template<class Head,class... Tail>inline void dump(Head&& head, Tail&&... tail){cout<<head<<", ";dump(forward<Tail>(tail)...);} template<typename T>inline istream &operator>>(istream&input,vector<T>&v){for(auto &elemnt:v)input>>elemnt;return input;} std::vector<ll> divisor(ll n){ std::vector<ll> div; for(ll p=1;p*p<=n;++p){ if(n%p==0){ div.push_back(p); if(p*p!=n)div.push_back(n/p); } } std::sort(div.begin(),div.end()); return div; } main(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(10); ll a,b; cin>>a>>b; auto div=divisor(a); for(auto& x:div){ if(x%b==0){ cout<<"YES"<<endl; return 0; } } cout<<"NO"<<endl; }