1
//
1137 Accepted 0 196 483 C++
2
3 #include < iostream >
4 #include < set >
5 using namespace std ;
6
7 multiset < int > data ;
8
9 int inn ;
10
11 int main()
12 {
13 while ( cin >> inn && inn )
14 {
15 int inm ;
16
17 data.clear() ; // 注意循环中要清空集合
18
19 for ( int i = 1 ; i <= inn; i ++ )
20 {
21 cin >> inm ;
22 data.insert( inm ) ;
23 }
24
25 int num = inn / 2 + 1 ;
26 multiset < int > ::iterator posi = data.begin() ;
27
28 int ans = 0 ;
29 for ( int i = 1 ; i <= num; i ++ , posi ++ )
30 {
31 ans += ( * posi) / 2 + 1 ;
32 }
33
34 printf( " %d\n " , ans ) ;
35 }
36 return 0 ;
37 }
2
3 #include < iostream >
4 #include < set >
5 using namespace std ;
6
7 multiset < int > data ;
8
9 int inn ;
10
11 int main()
12 {
13 while ( cin >> inn && inn )
14 {
15 int inm ;
16
17 data.clear() ; // 注意循环中要清空集合
18
19 for ( int i = 1 ; i <= inn; i ++ )
20 {
21 cin >> inm ;
22 data.insert( inm ) ;
23 }
24
25 int num = inn / 2 + 1 ;
26 multiset < int > ::iterator posi = data.begin() ;
27
28 int ans = 0 ;
29 for ( int i = 1 ; i <= num; i ++ , posi ++ )
30 {
31 ans += ( * posi) / 2 + 1 ;
32 }
33
34 printf( " %d\n " , ans ) ;
35 }
36 return 0 ;
37 }