Posted on 2009-03-23 16:15
Hero 阅读(87)
评论(0) 编辑 收藏 引用 所属分类:
代码如诗--ACM
1 //1182 Accepted 0 180 552 C++
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5
6 int inn ;
7 int maxval ;
8
9 int main()
10 {
11 while( scanf( "%d", &inn ) != EOF )
12 {
13 int num ; int cnt = 0 ;
14 for( int i=1; i<=inn; i++ )
15 {
16 scanf( "%d", &num ) ;
17 if( 1 == i ) maxval = num ;
18 else
19 {
20 if( num > maxval )
21 {
22 maxval = num ;
23 cnt = 0 ;
24 }
25 else if( num == maxval )
26 {
27 cnt++ ;
28 }
29 }
30 }
31
32 if( 0 == cnt )
33 {
34 printf( "%d\n", maxval ) ;
35 }
36 else
37 {
38 printf( "tie\n" ) ;
39 }
40 }
41
42 return 0 ;
43 }