CrackCell's dustbin

1035 BG

 1 #include<iostream>
 2 
 3 using namespace std;
 4 
 5 int current;
 6 int array[100];
 7 int p=0;
 8 
 9 void input(){
10     cin>>current;
11 }
12 
13 bool isOdd(int a){
14     return !(((a/2)*2)==a);
15 }
16 
17 void output(){
18     for(int i=0;i<p;i++){
19         cout<<(isOdd(array[i])==1?(array[i]+1)/2:array[i]/2)<<endl;
20     }
21 }
22 
23 int main(){
24     input();
25     while(current!=0){
26         array[p++]=current;
27         input();
28     }
29     output();
30     return 0;
31 }
32 

posted on 2007-10-31 23:50 CrackCell 阅读(246) 评论(0)  编辑 收藏 引用 所属分类: whuoj_notes


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