我希望你是我独家记忆

一段永远封存的记忆,随风而去
posts - 263, comments - 31, trackbacks - 0, articles - 3
   :: 首页 :: 新随笔 ::  :: 聚合  :: 管理

URAL1025

Posted on 2008-10-29 14:35 Hero 阅读(89) 评论(0)  编辑 收藏 引用 所属分类: 代码如诗--ACM
 1 // 1025 C++ Accepted 0.015 121 KB URAL
 2 
 3 #include <stdio.h>
 4 #include <stdlib.h>
 5 #include <string.h>
 6 
 7 const int size = 120 ;
 8 int data[size] ;
 9 
10 int ink ;
11 
12 int cmp( const void *a, const void * b ) 
13 {
14     return *(int *)a - *(int *)b ;
15 }
16 
17 int main()
18 {
19     while( scanf( "%d"&ink ) != EOF )
20     {
21         forint i=1; i<=ink; i++ ) scanf( "%d"&data[i] ) ;
22 
23         qsort( data+1, ink, sizeof(data[1]), cmp ) ;
24 
25         int maxi = (ink+1/ 2 ; int out = 0 ;
26         forint i=1; i<=maxi; i++ )
27         {
28             out += (data[i]+1/ 2 ;
29         }
30 
31         printf( "%d\n",out ) ;
32     }
33 
34     return 0 ;
35 }

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理