标签:
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int a[10000000]; int main() { int n,i,ans; while(~scanf("%d",&n)) { int t,ans=0; for(i=0;i<n;i++) { scanf("%d",&t); if(t!=0) { a[ans++]=t; break; } } for(i=i+1;i<n;i++) { scanf("%d",&t); if(t!=0) { a[ans++]=t; } } printf("%d\n",ans); if(ans!=0) { printf("%d",a[0]); for(i=1;i<ans;i++) printf(" %d",a[i]); printf("\n"); } } return 0; }
标签:
原文地址:http://www.cnblogs.com/cancangood/p/4354427.html