fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. long long t,l,r,sum=0;
  7. cin>>t;
  8. while(t--)
  9. {
  10. cin>>l>>r;
  11. sum=l;
  12. for(int i=l+1; i<=r; i++)
  13. {
  14. sum+=i;
  15. }
  16. cout<<sum<<endl;
  17.  
  18. }
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5280KB
stdin
3
3 6
11 15
20 25
stdout
18
65
135