Sponsors

Tag: problem: (D) My pretty girl Noora Solution In C/C++

Codeforces Round #422 (Div....

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

Advertisement

spot_img