Submission

Status:
PPPPPPPPPPPPPPPPPPPP

Score: 100

User: njoop

Problemset: ผลบวก (ง่าย)

Language: cpp

Time: 0.202 second

Submitted On: 2024-11-30 22:23:02

#include <bits/stdc++.h>

using namespace std;

long long arr[1000010], ps[1000010];

int main() {
    int n, q, x, y;
    cin >> n;
    cin >> arr[0];
    ps[0] = arr[0];
    for(int i=1; i<n; i++) {
        cin >> arr[i];
        ps[i] = arr[i] + ps[i-1];
    }
    cin >> x >> y;
    cout << ps[y] - ps[x-1] << "\n";
    return 0;
}