Guest User

Untitled

a guest
Jul 5th, 2019
1,278
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.  
  8. int n;
  9. cin>>n;
  10. vector<int> a(n);
  11. for (int i = 0; i<n; i++) cin>>a[i];
  12.  
  13. vector<int> pref(n+1);
  14. for (int i = 1; i<=n; i++) pref[i] = pref[i-1] + a[i-1];
  15. int q;
  16. cin>>q;
  17. int l, r;
  18. for (int i = 0; i<q; i++)
  19. {
  20. cin>>l>>r; cout<<(pref[r]-pref[l-1])/10<<endl;
  21. }
  22. }
RAW Paste Data