Untitled
unknown
c_cpp
2 years ago
2.5 kB
11
Indexable
// Bismillahir Rahmanir Rahim #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define t_sum(sv) (accumulate(sv.begin(),sv.end(),0ll)) #define count_n(v,n) (count(v.begin(),v.end(),n)) #define asort(s1) (sort(s1.begin(), s1.end())) #define dsort(s1) (sort(s1.begin(), s1.end(),greater <>())) #define all(x) (x).begin(), (x).end() #define REV(v) (reverse(v.begin(),v.end())) #define max_v(a) (*max_element(a.begin(),a.end())) #define mini_v(a) (*min_element((a).begin(), (a).end())) #define print(x) for(auto &value : x){ cout << value << " ";}cout << endl; //# #define scan(n,x) for(ll i=0 ; i<n ; i++) {ll nx; cin >> nx; x.pb(nx);} #define binary(b,value) (binary_search(b.begin(),b.end(),value)) #define uper_b(b,value) (upper_bound (b.begin(),b.end(),value)) #define Low_b(b,value) (lower_bound (b.begin(),b.end(),value)) #define sz(v) ((ll)(v).size()) #define cos(a) cos(a*pi/180) #define sin(a) sin(a*pi/180) #define tan(a) tan(a*pi/180) ll reverse_num(ll n){ ll tmp=n, ans=0, r; while(tmp>0){ r=tmp%10; ans=ans*10+r; tmp/=10; } return ans; } #define pi 3.141592654 #define pb push_back #define w(n) while(n--) #define f first #define s second #define nl "\n" #define bye break; #define edl cout<<endl; #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; #define Yes cout << "Yes" << endl; #define No cout << "No" << endl; #pragma GCC optimize("Ofast") ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} bool is_prime[1011]; ll mx=10011; vector<ll>primes; void seive() { ll t; cin >> t; vector<ll>v; scan(t,v); asort(v); ll x = v[0],cnt=0; for(ll i=1; i<sz(v); i++) { if(v[i]%x == 0) { cnt++; } } set<ll>sat; if(cnt == t-1) { for(ll i=1; i<=sqrt(v[0]); i++) { if(v[0]%i==0) { sat.insert(i); if(i != (v[0]/i)) { sat.insert(v[0]/i); } } } if(v[0] == 1) {cout << 1 << endl;} else {cout << sat.size() << endl;} } else { cout << 1 << endl; } } int32_t main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); seive(); return 0; }
Editor is loading...