topic source
2021 Blue Bridge Cup Provincial
Topic link: https://www.lanqiao.cn/problems/1463/learning/
test center
number theory, violence
Video explanation
https://www.bilibili.com/video/BV1H3411H7mW/
ideas
First of all, it is not difficult to find L, W, HL, W, HL , W , H are allnnfactor of n , then we willnnAll the factors of n are extracted, and then we enumerateL, WL, WL and W can be
Then if we find LLL andWWProduct of W kkk is stillnnIf it is a factor of n , we can put this set of (three elements) data into set
itset
the number of elements in our final output is our answer
code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define endl "\n"
#define PII pair<int,int>
#define INF 0x3f3f3f3f
ll n;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// cin>>n;
n = 2021041820210418;
vector<ll> V;
V.push_back(1);
for(ll i = 2;i * i <= n; ++i) {
if(n % i == 0) {
V.push_back(i);
if(n/i == i) continue;
V.push_back(n/i);
}
}
V.push_back(n);
int l = V.size();
// cout<<"因子数为: "<<l<<endl;
set<vector<ll>> S;
for(int i = 0;i < l; ++i) {
for(int j = 0;j < l; ++j) {
ll k = V[i] * V[j];
if(n % k) continue;
vector<ll> t;
t.push_back(V[i]);
t.push_back(V[j]);
t.push_back(n/k);
S.insert(t);
}
}
cout<<S.size()<<endl;
return 0;
}
Get the answer as 2430 24302430