Untitled diff

Created Diff never expires
15 removals
49 lines
15 additions
49 lines
#include <stdio.h>
#include <stdio.h>
#include <stack>
#include <stack>
#include <map>
#include <map>
#include <string.h>
#include <string.h>
#include <string>
#include <string>
#include <iostream>
#include <iostream>
#include <algorithm>
#include <algorithm>
#include <iomanip>
#include <iomanip>
#include <math.h>
#include <math.h>
#include <vector>
#include <vector>
#include <set>
#include <set>
#include <queue>
#include <queue>
#include <functional>
#include <functional>
using namespace std;
using namespace std;
#define ll long long
#define ll long long
#define mp make_pair
#define mp make_pair
#define pb push_back
#define pb push_back
//#define ld long double
//#define ld long double
const double sn = 1e-6;
const double sn = 1e-6;
ll mod = 1000000007;
ll mod = 1000000007;
ll dp[5000005];
ll dp[5000005];


ll t, l, r;
int t, l, r;
int main() {
int main() {
scanf("%I64d%I64d%I64d", &t, &l, &r);
scanf("%d %d %d", &t, &l, &r);
ll ans = 0;
ll ans = 0;
for (ll i = 2; i <= r; i++) {
for (int i = 2; i <= r; i++) {
dp[i] = LLONG_MAX;
dp[i] = LLONG_MAX;
}
}
for (ll i = 2; i <= r; i++) {
for (int i = 2; i <= r; i++) {
dp[i] = min(dp[i], ((i*(i - 1)) / 2));
dp[i] = min( dp[i], 1ll * i * (i - 1) / 2 );


for (ll j = 2 * i; j <= r; j += i) {
for (int j = 2 * i; j <= r; j += i) {
ll t = j/i;
int t = j/i;
ll val = ((t*(t - 1)) / 2);
ll val = 1ll * t * (t - 1) / 2;
val = (val * i);
val = (val * i);
dp[j] = min(dp[j], (val + dp[i]));
dp[j] = min(dp[j], (val + dp[i]));
}
}
}
}
ll ti = 1;
ll ti = 1;
for (ll i = 0; i <= r - l; i++) {
for (int i = 0; i <= r - l; i++) {
ll v1 = ti%mod, v2 = dp[i+l]%mod;
ll v1 = ti, v2 = dp[i+l]%mod;
ll v3 = (v1*v2) % mod;
ll v3 = v1 * v2;
ans = (ans + v3) % mod;
ans = (ans + v3) % mod;
ti = (ti*t) % mod;
ti = (ti*t) % mod;
}
}
printf("%I64d\n", ans%mod);
printf("%I64d\n", ans%mod);
return 0;
return 0;
}
}