update pdf
This commit is contained in:
parent
4d8d6bda29
commit
fc5fc3cbd5
BIN
day12/20240814sol.pdf
Normal file
BIN
day12/20240814sol.pdf
Normal file
Binary file not shown.
@ -4,9 +4,10 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
#define int long long
|
#define int long long
|
||||||
|
|
||||||
const int MAX_N = 2e8+5;
|
const int MAX_N = 1000+5;
|
||||||
int a[MAX_N];
|
int a[MAX_N];
|
||||||
int n,amax=INT_MIN,ans=0;
|
int n,amax=INT_MIN,ans=0;
|
||||||
|
unordered_map<int,long long> um;
|
||||||
int readint();
|
int readint();
|
||||||
|
|
||||||
signed main(signed argc,char *argv[]){
|
signed main(signed argc,char *argv[]){
|
||||||
@ -22,16 +23,22 @@ signed main(signed argc,char *argv[]){
|
|||||||
#endif
|
#endif
|
||||||
n=readint();
|
n=readint();
|
||||||
for(int i=1;i<=n;i++){
|
for(int i=1;i<=n;i++){
|
||||||
int input=readint();
|
a[i]=readint();
|
||||||
a[input]++;
|
|
||||||
amax=max(amax,input);
|
|
||||||
}
|
}
|
||||||
for(int i=2;i<=amax;i++){
|
for(int i=1;i<=n;i++){
|
||||||
int nans = 0;
|
int num=a[i];
|
||||||
for(int j=1;(i*j)<=amax;j++){
|
for(int j=2;j<=sqrt(a[i]);j++){
|
||||||
nans+=a[i*j]*i*j;
|
if(num%j==0){
|
||||||
|
um[j]+=a[i];
|
||||||
|
while(num%j==0)num/=j;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ans=max(ans,nans);
|
if(num>1){
|
||||||
|
um[num]+=a[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(auto i : um){
|
||||||
|
ans+=i.second;
|
||||||
}
|
}
|
||||||
cout<<ans<<endl;
|
cout<<ans<<endl;
|
||||||
#ifdef OITEST
|
#ifdef OITEST
|
||||||
|
Loading…
Reference in New Issue
Block a user