| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
为什么wa了?我测试给的数据没问题呀!!高手帮忙看看:#include <iostream>
#include <fstream>
using namespace std;
int n,m;
int cow[200][200];//表示第i只猪所喜欢的stall
int scow[200]; // 第i只猪喜欢的stall的数目
int mark[1000];//标识这个stall是否可用
int compute(int p){
if(p==n)return 0;
int max=0;
for(int i=0;i<scow[p];i++){
int tmp=0;
if(mark[cow[p][i]]==0){
mark[cow[p][i]]=1;
tmp=1+compute(p+1);
if(tmp>max)max=tmp;
mark[cow[p][i]]=0;
}
}
int tmp=0;
tmp=compute(p+1);
if(tmp>max)max=tmp;
return max;
}
void init(){
memset(cow,0,sizeof(cow));
memset(scow,0,sizeof(scow));
memset(mark,0,sizeof(mark));
}
void main(){
// ifstream cin("data.txt");
cin>>n>>m;
init();
for(int i=0;i<n;i++){
cin>>scow[i];
for(int j=0;j<scow[i];j++){
cin>>cow[i][j];
}
}
int max=compute(0);
cout<<max<<endl;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator