lina_os

Untitled

Nov 3rd, 2024
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <string>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main(){
  9.  
  10. int t; cin>>t;
  11. while(t>0){t--;
  12. double l,r; cin>>l>>r;
  13. double sum=(r-l+1)*((r+l)/2);
  14. cout<<(long long)sum<<endl;
  15. }
  16.  
  17. return 0;
  18. }
  19.  
  20.  
Advertisement
Add Comment
Please, Sign In to add comment