Pages

Friday 26 October 2012

UVA - 10656 - Maximum Sum (II)

#include <stdio.h>
#include <stdbool.h>

int main()
{
    int cases,i,j=0;
    while(1){
        scanf("%d",&cases);
        if(cases==0)
            break;
        bool first=true;
        for(i=0;i<cases;i++){
          scanf("%d",&j);
          if(j!=0){
            if(!first)
                printf(" ");
            printf("%d",j);
            first=false;
          }
        }
        if(first)
            printf("0");
        printf("\n");

    }
    return 0;
}

No comments:

Post a Comment