#include <bits/stdc++.h>
#define int ll
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rng(i,c,n) for(int i=c;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3PGDklf ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vector<int>;
void print(){cout<<'\n';}
template<class h,class...t>
void print(const h&v,const t&...u){cout<<v<<' ',print(u...);}
// e
const int _n=10000001;
int ps[_n];
signed main(){
_3PGDklf;
for(int i=1;i<_n;i++){
for(int j=2*i;j<_n;j+=i){
ps[j]-=i;
}
}
for(int i=1;i<_n;i++){
ps[i]+=ps[i-1];
}
int l,r;
cin>>l>>r;
auto f=[&](int n){
return n==0?0:n*(n+1)/2+ps[n];
};
print(f(r)-f(l-1));
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1144 ms |
78576 KB |
Output isn't correct |
2 |
Incorrect |
1151 ms |
78572 KB |
Output isn't correct |
3 |
Incorrect |
1223 ms |
78576 KB |
Output isn't correct |
4 |
Incorrect |
1082 ms |
78572 KB |
Output isn't correct |
5 |
Incorrect |
1090 ms |
78572 KB |
Output isn't correct |
6 |
Incorrect |
1159 ms |
78576 KB |
Output isn't correct |
7 |
Incorrect |
1114 ms |
78572 KB |
Output isn't correct |
8 |
Incorrect |
1103 ms |
78572 KB |
Output isn't correct |