Posted on 2008-10-13 10:48
Hero 阅读(221)
评论(0) 编辑 收藏 引用 所属分类:
代码如诗--ACM
1 // 1010 C++ Accepted 0.031 URAL
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 const int size = 1010000 ;
7
8 typedef long long llong ;
9
10 llong data[size] ;
11
12 int inn ;
13
14 //template<class T>
15 llong myabs( llong x )
16 {
17 if( x >= 0 ) return x ;
18 else return 0-x ;
19 }
20
21 int main()
22 {
23 while( scanf( "%d", &inn ) != EOF )
24 //scanf( "%d", &inn ) ;
25 {
26 for( int i=1; i<=inn; i++ ) scanf( "%I64d", &data[i] ) ;
27
28 llong maxk = -1 ; int outa, outb ;
29
30 for( int i=1; i<inn;i++ )
31 {
32 llong curk = myabs( data[i+1] - data[i] ) ;
33 if( curk > maxk ) { outa = i ; outb = i+1 ; maxk = curk ; }
34 }
35
36 printf( "%d %d\n", outa, outb ) ;
37 }
38
39 return 0 ;
40 }