Skip to content

Instantly share code, notes, and snippets.

@bouk
Created May 12, 2013 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bouk/5563084 to your computer and use it in GitHub Desktop.
Save bouk/5563084 to your computer and use it in GitHub Desktop.
#include <cstdio>
using namespace std;
int N;
int number;
bool first;
int main()
{
while(scanf("%d", &N) != EOF && N)
{
first = true;
for(int i = 0; i < N; i++)
{
scanf("%d", &number);
if(number)
{
if(!first)
{
printf(" ");
}
first = false;
printf("%d", number);
}
}
if(first)
{
printf("0");
}
printf("\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment