Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- ll MOD = 1000000007;
- const int SINF = 1000000009;
- const ll INF = 1000000000000000018;
- #define MAXN 100001
- #define nl "\n"
- #define nlf "\n", cout.flush()
- #define inv(a) powr((a), (MOD - 2))
- #define all(c) (c).begin(),(c).end()
- #define gfor(t) rep(_, 1, (t) + 1)
- #define caseprint cout << "Case #" << _ << ": ";
- #define rep(i,a,b) for(ll i = (a); i < (b); i ++)
- #define prec(n) cout << fixed << setprecision(n)
- #define PI 3.14159265358979323846264338327951
- #define ifalse ios_base::sync_with_stdio(false), cin.tie(NULL)
- template<typename T> void toInt(string s, T &a) { istringstream(s) >> a; }
- ll gcd(ll a, ll b) { ll t; while(a) { t = a; a = b%a; b = t; } return b; }
- ll sub(ll a, ll b) { a -= b; a = (a + MOD) % MOD; return a; }
- ll mul(ll a, ll b) { return ((a % MOD) * (b % MOD)) % MOD; }
- ll add(ll a, ll b) { a += b; a %= MOD; return a; }
- ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
- ll powr(ll a, ll b) {
- ll x = 1LL;
- while(b) {
- if(b & 1) x = mul(x, a);
- a = mul(a, a), b >>= 1;
- }
- return x%MOD;
- }
- template <typename T, typename U, typename V> class triple {
- public:
- T first;
- U second;
- V third;
- triple() {}
- triple(T a, U b, V c) : first(a), second(b), third(c) {}
- };
- using tlll = triple<ll, ll, ll>;
- // #define PRM
- #ifdef PRM
- vector<int> primes;
- bitset<MAXN> isprm;
- vector<int> spf(MAXN);
- void sieve(){
- for(int i = 0;i < MAXN; ++i){
- spf[i] = -1;
- }
- spf[0] = 0;
- spf[1] = 1;
- spf[2] = 2;
- for(int i = 4;i < MAXN; i += 2) isprm[i] = 1, spf[i] = 2;
- primes.push_back(2);
- isprm[0] = isprm[1] = 1;
- for(int i = 3;i < MAXN; i += 2){
- if(isprm[i]) continue;
- spf[i] = i;
- primes.push_back(i);
- for(int j = 2*i;j < MAXN; j += i){
- if(spf[j] == -1) spf[j] = i;
- isprm[j] = 1;
- }
- }
- }
- #endif
- void solve() {
- ll l,r;
- cin>>l>>r;
- ll ans=0;
- ll sum=0;
- vector<ll> v(r+1,0);
- int k=1;
- for(int j=1;j<=r;j+=2)
- {
- k=1;
- while(j*k <= r )
- {
- v[j*k]+=j;
- k++;
- }
- }
- for(int i=l;i<=r;i++) sum+=v[i];
- cout<<sum<<endl;
- }
- int main(){
- ifalse;
- int t = 0;
- if(!t) cin >> t;
- gfor(t){
- // caseprint;
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement