https://i2.wp.com/eblogarithm.com/wp-content/uploads/2017/07/Codeforces-Round-422-Div-2-problem-D-My-pretty-girl-Noora-Solution-In-CC1.png?fit=640%2C360

Codeforces Round #422 (Div. 2), problem: (D) My pretty girl Noora Solution In C/C++

#include<bits/stdc++.h>
using namespace std;
long long f[5000010],pwr[5000010],mod=1e9+7,t,r,l,ans;
main()
{
int i,j,k;
cin>>t>>l>>r;
pwr[0]=1;
//for(i=1;i<=r-l+1;i++)pwr[i]=(1ll*pwr[i-1]*t)%mod;
for(i=0;i<=r;i++)
f[i]=1e18;
f[1]=0;
for(i=1;i<=r;i++)
{
for(j=2*i,k=2;j<=r;j+=i,k++)
{
f[j]=min(f[j],(1ll*i*(k-1)*k)/2+f[i]);
}
}
ans=0;long long pr=1;
for(i=l;i<=r;i++)
ans=(ans+((f[i])%mod*pr)%mod)%mod,pr=(pr*t)%mod;
cout<<ans<<endl;
}

(Visited 16 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: