朱色虫居
Pages
Home
Featured Posts
2006/10/07
10656-Maximum Sum II
/*
"Maximum Sum II"
Level:1.5
Date:2006/10/6
技巧: 因為都是正整數的sequence,只有零不印.
*/
#include
main(){
int n=0,input=0,flag=0;
while(scanf("%d",&n)==1 && n!=0){
flag=0;
while(n-- >0){
scanf("%d",&input);
if(input == 0) continue;
if(flag != 0)
printf(" ");
printf("%d",input);
flag=1;
}
if(flag == 1)
printf("\n");
else
printf("0\n"); /* 全部integer都是0的case */
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment