#include <stdio.h>
int main() {
int i, maior, menor, soma, teste=1;
int temperatura[10000], n, m;
while (n > 0) {
//lê as temperaturas e calcula o somatório do primeiro intervalo
soma = 0;
for (i = 0; i < m; i++) {
scanf("%d", &temperatura
[i
]); soma += temperatura[i];
}
maior = soma;
menor = soma;
//Calcula a soma dos outros intervalos usando a soma do intervalo anterior
for (i=m; i < n; i++) {
//for (; i < n; i++) {
scanf("%d", &temperatura
[i
]); soma = soma + temperatura[i] - temperatura[i-m];
if (soma > maior) {
maior = soma;
} else if (soma < menor) {
menor = soma;
}
}
printf("Teste %d\n%d %d\n\n", teste
++, menor
/m
, maior
/m
);
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbigpIHsKICBpbnQgaSwgbWFpb3IsIG1lbm9yLCBzb21hLCB0ZXN0ZT0xOwogIGludCB0ZW1wZXJhdHVyYVsxMDAwMF0sIG4sIG07CiAgCiAgc2NhbmYoIiVkICVkIiwgJm4sICZtKTsKICAKICB3aGlsZSAobiA+IDApIHsKICAJICAvL2zDqiBhcyB0ZW1wZXJhdHVyYXMgZSBjYWxjdWxhIG8gc29tYXTDs3JpbyBkbyBwcmltZWlybyBpbnRlcnZhbG8KICAgICAgc29tYSA9IDA7CiAgICAgIGZvciAoaSA9IDA7IGkgPCBtOyBpKyspIHsKCQlzY2FuZigiJWQiLCAmdGVtcGVyYXR1cmFbaV0pOwoJCXNvbWEgKz0gdGVtcGVyYXR1cmFbaV07CgkgIH0KCSAgCiAgICAgIG1haW9yID0gc29tYTsKICAgICAgbWVub3IgPSBzb21hOwogICAgICAKICAgICAgLy9DYWxjdWxhIGEgc29tYSBkb3Mgb3V0cm9zIGludGVydmFsb3MgdXNhbmRvIGEgc29tYSBkbyBpbnRlcnZhbG8gYW50ZXJpb3IKICAgICAgZm9yIChpPW07IGkgPCBuOyBpKyspIHsKICAgICAgLy9mb3IgKDsgaSA8IG47IGkrKykgewoJCXNjYW5mKCIlZCIsICZ0ZW1wZXJhd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