fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.  
  7. ios::sync_with_stdio(false);
  8. cin.tie(NULL);
  9.  
  10. long long l;
  11. long long r;
  12.  
  13. cin>>l>>r;
  14.  
  15. long long res=0;
  16. for(long long i=l; i<=r; ++i){
  17. long long suml=0;
  18. long long sumr=0;
  19. for(long long j=1; j<=l; ++j){
  20. suml=suml+(i%j);
  21. }
  22. for(long long j=1; j<l; ++j){
  23. sumr=sumr+(i%j);
  24. }
  25.  
  26. if(suml==sumr){
  27. res=res+i;
  28. }
  29.  
  30. }
  31.  
  32. cout<<res;
  33.  
  34. }
Success #stdin #stdout 0.01s 5328KB
stdin
1 3
stdout
6