#include <iostream.h> int a[100];int i; static int stat=0; void dfs(int n,int oneCount) { if(oneCount>2||n==3&&oneCount!=2) return ; if(n==3&&oneCount==2) { for (i=0;i<n;i++) { cout<<a[i]<<' '; } cout<<endl; return ; } a[n]=0;dfs(n+1,oneCount); a[n]=1;dfs(n+1,oneCount+1); } void main() { dfs(0,0); }