Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include<math.h>
- using namespace std;
- int main()
- {
- int b,j,k;
- cin>>b>>j;
- vector<int>n;
- vector<int>m;
- k=0;
- for(int i=1;i<=sqrt(b);i++)
- {
- if(b%i==0)
- {
- n.push_back(i);
- if(i!=b/i)
- {
- n.push_back(b/i);
- }
- }
- }
- for(int i=1;i<=sqrt(j);i++)
- {
- if(j%i==0)
- {
- m.push_back(i);
- if(i!=j/i)
- {
- m.push_back(j/i);
- }
- }
- }
- for(int i=0;i<n.size();i++)
- {
- for(int y=0;y<m.size();y++)
- {
- if(n[i]==m[y])
- {
- k++;
- }
- }
- }
- cout<<k;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement