3 1 2 3 3 2 6 4
1 2 1 2use scanf to avoid Time Limit ExceededHintHint
#include<stdio.h> #include<stdlib.h> int main() { int n; while(~scanf("%d",&n)) { int a,b,max,m,k=1,c,i; scanf("%d%d",&a,&b); max=abs(a-b); for(i=2;i<n;i++) { scanf("%d",&c); m=abs(c-b); if(m>max) { max=m; k=i; } b=c; } printf("%d %d\n",k,k+1); } return 0; }
hdu 1594 (find the max) (绝对值最大值比较大小),布布扣,bubuko.com
hdu 1594 (find the max) (绝对值最大值比较大小)
原文地址:http://blog.csdn.net/ice_alone/article/details/38706993