纯
#include#include #include #include using namespace std;const int maxn=100;int g[maxn][maxn];int n,cnt,ans;int b[maxn],bb[maxn];void dfs(int x){ if(x>n) { if(cnt>ans) { ans=cnt; memcpy(b,bb,sizeof(bb)); } return; } int flag=1; for(int i=1;i ans) dfs(x+1);}void init(){ cnt=0; ans=0; memset(b,0,sizeof(b)); memset(bb,0,sizeof(bb)); memset(g,0,sizeof(g));}int main(){ while(~scanf("%d",&n)&&n) { init(); for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) scanf("%d",&g[i][j]); dfs(1); printf("%d\n",ans); } return 0;}
板子