Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize ("O3")
- #pragma GCC target ("sse4")
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- typedef pair<int, int> pii;
- typedef pair<string,int> psi;
- typedef vector<int> vi;
- typedef vector<string> vs;
- typedef vector<char> vc;
- typedef vector<ll> vll;
- typedef vector<vector<int>> vvi;
- typedef vector<vector<string>> vvs;
- typedef vector<vector<ll>> vvll;
- #define FOR(i, a, b) for (auto i=a; i<=(b); i++)
- #define FORd(i,b,a) for (int i =b; i >= a; i--)
- #define sz(x) (int)(x).size()
- #define mp make_pair
- #define pb push_back
- #define f first
- #define s second
- #define ins insert
- const int MOD = 1000000007;
- //type functions here
- int main()
- {
- //std::ios::sync_with_stdio(false);
- // cin.tie(NULL);
- // cout.tie(0);
- vll v,ps;
- ll size,sum=0;
- // cin>>size;
- scanf("%lld",&size);
- FOR(q,1,size)
- {
- ll temp;
- // cin>>temp;
- scanf("%lld",&temp);
- v.pb(temp);
- sum+=temp;
- // cout<<sum<<" ";
- ps.pb(sum);
- }
- ll i,j,ans=0;
- ll z;
- // cin>>z;
- scanf("%lld",&z);
- FOR(w,1,z){
- // cin>>i>>j;
- scanf("%lld,%lld",&i,&j);
- if(i==0)
- //cout<<ps[j]<<endl;
- printf("%lld \n",ps[j]);
- else
- {
- ans=ps[j]-(ps[i-1]);
- //cout<<ps[j]<<" "<<ps[i-1]<<" ";
- //cout<<ans<<endl;
- printf("%lld ",ans);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement