Ahmed_Negm

Untitled

Apr 14th, 2022
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. #include<iomanip>
  4. #include<algorithm>
  5. #include<cstdlib>
  6. #include<cstring>
  7. #include<vector>
  8. #include<utility>
  9.  
  10. #define ll long long
  11. #define sz(x) int(x.size())
  12. #define all(x) x.begin(),x.end()
  13. using namespace std;
  14.  
  15. void Fast_IO(){
  16.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  17.     #ifndef ONLINE_JUDGE
  18.         freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  19.     #endif
  20. }
  21.  
  22.  
  23.  
  24.  
  25.  
  26. void solve(){
  27.   ll a,b; cin>>a>>b;
  28.     vector<ll>v={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71};
  29. bool flag =0;
  30.  
  31.  
  32. for(int i=0; i<sz(v); i++){
  33.     if(a%v[i]==0 && b%v[i]==0){
  34.         flag = true;
  35.         break;
  36.     }
  37. }
  38.  
  39. if(flag) cout<<"YES";
  40. else cout<<"NO";
  41.  
  42.  
  43. }
  44.  
  45. int main(){
  46.     Fast_IO();
  47. int t =1;
  48. //cin>>t;
  49. while(t--){
  50. solve();
  51. }
  52. return 0;
  53. }  
Advertisement
Add Comment
Please, Sign In to add comment