Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.004 s | 55 KBi |
#2 |
Correcto
|
0.004 s | 1 KBi |
#3 |
Correcto
|
0.004 s | 1 KBi |
#4 |
Correcto
|
0.004 s | 1 KBi |
#5 |
Correcto
|
0.004 s | 1 KBi |
#6 |
Correcto
|
0.003 s | 1 KBi |
#7 |
Correcto
|
0.004 s | 1 KBi |
#8 |
Correcto
|
0.005 s | 4 KBi |
#9 |
Correcto
|
0.007 s | 1 KBi |
#10 |
Correcto
|
0.008 s | 1 KBi |
#11 |
Correcto
|
0.008 s | 1 KBi |
#12 |
Correcto
|
0.007 s | 1 KBi |
#13 |
Correcto
|
0.01 s | 1 KBi |
#14 |
Correcto
|
0.007 s | 1 KBi |
#include <stdio.h> int main(void) { int i, n, c, p, q; long long sum = 0, arr_sum[10000]; scanf("%d", &n); for (i = 0; i < n; i++) { scanf("%lld", &arr_sum[i]); sum += arr_sum[i]; arr_sum[i] = sum; } scanf("%d", &c); for (i = 0; i < c; i++) { scanf("%d %d", &p, &q); if (p - 1 >= 0) { printf("%lld\n", arr_sum[q] - arr_sum[p - 1]); } else { printf("%lld\n", arr_sum[q]); } } return (0); }