#include<iostream>#include<algorithm>#include<unordered_map>#include<vector>usingnamespace std;typedeflonglong LL;constint N =110, mod =1e9+7;intmain(){int n;
cin >> n;
unordered_map<int,int> primes;while(n --){int x;
cin >> x;for(int i =2; i <= x / i; i ++)while(x % i ==0){
x /= i;
primes[i]++;}if(x >1) primes[x]++;}
LL res =1;for(auto p : primes) res = res *(p.second +1)% mod;
cout << res << endl;return0;}
AcWing 871. 约数之和
#include<iostream>#include<algorithm>#include<unordered_map>#include<vector>usingnamespace std;typedeflonglong LL;constint N =110, mod =1e9+7;intmain(){int n;
cin >> n;
unordered_map<int,int> primes;while(n --){int x;
cin >> x;for(int i =2; i <= x / i; i ++)while(x % i ==0){
x /= i;
primes[i]++;}if(x >1) primes[x]++;}
LL res =1;for(auto prime : primes){
LL a = prime.first, b = prime.second;
LL t =1;while(b --) t =(t * a +1)% mod;
res =(res * t)% mod;}
cout << res << endl;return0;}
872. 最大公约数
#include<iostream>#include<cstring>#include<algorithm>usingnamespace std;intgcd(int a,int b){return b ?gcd(b, a % b): a;}intmain(){int n;
cin >> n;while(n --){int a, b;scanf("%d %d",&a,&b);
cout <<gcd(a, b)<< endl;}return0;}