//尼玛,这道题简直是阅读理解啊,前面那么多废话,其实直奔输出输入看即可
#include <stdio.h>
int numOfSections;
int magicField[1001];
int main(){
scanf("%d", &numOfSections);
int section;
for (section = 1; section <= numOfSections; section++)
scanf("%d", &magicField[section]);
int maxMagic = 0;
int middleSection = 0;
int last = numOfSections - 1;
for (section = 2; section <= last; section++){
int magic = magicField[section - 1] + magicField[section] + magicField[section + 1];
if (magic > maxMagic){
maxMagic = magic;
middleSection = section;
}
}
printf("%d %d\n", maxMagic, middleSection);
return 0;
}
URAL 1910 Titan Ruins: Hidden Entrance
最新推荐文章于 2017-02-13 20:49:13 发布