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 |
虽然代码比较烂,可是看不出为啥错额,附代码,求各位帮忙看看!#include<iostream> #include<vector> using namespace std; struct categories { int num; int leastnum; vector<string> courseid; }; int main() { int k,i; cin>>k; vector<string> courseselected; while(k!=0) { int m; cin>>m; categories *cate=new categories[m]; for(i=0;i<k;i++) { string a; cin>>a; courseselected.push_back(a); } // int flagno=0; int flag=0; for(i=0;i<m;i++) { cin>>cate[i].num>>cate[i].leastnum; for(int j=0;j<cate[i].num;j++) { string id; cin>>id; cate[i].courseid.push_back(id); } int count=0; for(int j=0;j<courseselected.size();j++) { for(int k=0;k<cate[i].courseid.size();k++) { if(courseselected[j]==cate[i].courseid[k]) { count++; } } } if(count<cate[i].leastnum) { flag=1; } } if(flag==1) cout<<"no"<<endl; else cout<<"yes"<<endl; cin>>k; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator