12002: 【原2002】Sum of Subsequences
题目
题目描述
author: xjia 原OJ链接:https://acm.sjtu.edu.cn/OnlineJudge-old/problem/2002
Description
Given a sequence of integers \( a_1, a_2, \dots, a_n \), calculate the sum of the subsequences \( a_i + a_2 + \dots + a_j \) with different pairs of \(i,j\) specified.
Input Format
Line 1: A positive integer \( n, 1 \leq n \leq 10000 \)
Line 2: A sequence of \(n\) integers \( a_1, a_2, \dots, a_n, \forall 1 \leq k \leq n, -10000 \leq a_k \leq 10000\)
Line 3: A positive integer \( m, 1 \leq m \leq 10000 \)
Line 4 to \( m+3 \): Two positive integers \(i, j, 1 \leq i \leq j \leq n\)
Output Format
Line 1 to \(m\): An integer representing the sum of the subsequence with the specified pair of \(i, j\)
Sample Input
5
1 3 4 2 5
2
2 4
1 3
Sample Output
9
8
Limits
Time limit: 1000ms, memory limit: 50000kb.
Oops! 本题目还没有解答!
助教老师们编题的速度,已经超过了解题的速度!
OJ翻了一新,但本解答集还大多用的是2017-2019级,甚至更早的同学们贡献的答案。
如果你已经AC了,可以的话,请您参考添加页面,与大家一起分享你的题解!