user-0 提问: 杭电2034题大神帮忙找下错

回复:
user: user-1
content: 我错了，没看清楚题。。。

user: user-1
content: 有一点错了，最后不能输出空格

user: user-2
content: 测试用例 3 3 1 3 3 1 4 7 应该输出3，你的代码输出3 3

user: user-3
content: #include <iostream> using namespace std; int a[110],b[110]; int flag[110]; int res[110]; int main() { 	int n,m; 	int t=0; 	while(cin>>n>>m){ 		t=0; 		memset(flag,0,sizeof(flag)); 		if(n==0&&m==0) break; 		 		for(int i=0;i<n;i++) 			cin>>a[i]; 		for(int i=0;i<m;i++) 			cin>>b[i]; 		for(int i=0;i<n;i++) 		    for(int j=0;j<m;j++)     			if(a[i]==b[j])  flag[i]=1; 		for(int i=0;i<n;i++) 			if(flag[i]==0)  				res[t++]=a[i]; 			 		//sort 		for(int i=0;i<t;i++) 		   for(int j=i;j<t;j++)    			  if(res[i]>res[j]) swap(res[i],res[j]);    		 		 		if(t==0) cout<<"NULL"; 		else for(int i=0;i<t;i++)		 			cout<<res[i]<<" "; 		cout<<endl;		 	} 	return 0; }

user: user-1
content: 0  3 1 2 3 这一组数据你试试。。。。

user: user-4
content: #include <algorithm> #include <iostream> #include <functional> #include <cstring> using namespace std; int main() {     char *Alphabet = "abcdefghijklmnopqrstuvwxyz" ;     char *Vowels   = "aeiou" ;     char *AlphaNum = "0123456789abcdef" ;     char result[45] ;     char *last ;      int lenA  = strlen(Alphabet) ;     int lenV  = strlen(Vowels  ) ;     int lenAN = strlen(AlphaNum) ;      cout << "Alphabet = " << Alphabet << endl ;     cout << "Vowels   = " << Vowels   << endl ;     cout << "AlphaNum = " << AlphaNum << endl ;      cout << "\nusing non-predicate versions" << endl ;      //non-predicate set_difference     last = set_difference(Alphabet, Alphabet+lenA,                           AlphaNum, AlphaNum+lenAN,                           result) ;     *last = 0 ;     cout << "set_difference(Alphabet, AlphaNum) =  " << result << endl ;      //non-predicate set_intersection     last = set_intersection(Alphabet, Alphabet+lenA,                             AlphaNum, AlphaNum+lenAN,                             result) ;     *last = 0 ;     cout << "set_intersection(Alphabet, AlphaNum) =  " << result << endl ;      //non-predicate set_symmetric_difference     last = set_symmetric_difference(Alphabet, Alphabet+lenA,                                     Vowels  , Vowels  +lenV,                                     result) ;     *last = 0 ;     cout << "set_symmetric_difference(Alphabet, Vowels) =  " << result << endl ;      //non-predicate set_union     last = set_union(Alphabet, Alphabet+lenA,                      AlphaNum, AlphaNum+lenAN,                      result) ;     *last = 0 ;     cout << "set_union(Alphabet, AlphaNum) =  " << result << endl ;      cout << "\nusing predicate versions" << endl ;      //predicate set_difference     last = set_difference(Alphabet, Alphabet+lenA,                           AlphaNum, AlphaNum+lenAN,                           result  , less<char>()) ;     *last = 0 ;     cout << "set_difference(Alphabet, AlphaNum) =  " << result << endl ;      //predicate set_intersection     last = set_intersection(Alphabet, Alphabet+lenA,                             AlphaNum, AlphaNum+lenAN,                             result  , less<char>()) ;     *last = 0 ;     cout << "set_intersection(Alphabet, AlphaNum) =  " << result << endl ;      //predicate set_symmetric_difference     last = set_symmetric_difference(Alphabet, Alphabet+lenA,                                     Vowels  , Vowels  +lenV,                                     result  , less<char>()) ;     *last = 0 ;     cout << "set_symmetric_difference(Alphabet, Vowels) =  " << result << endl ;      //predicate set_union     last = set_union(Alphabet, Alphabet+lenA,                      AlphaNum, AlphaNum+lenAN,                      result  , less<char>()) ;     *last = 0 ;     cout << "set_union(Alphabet, AlphaNum) =  " << result << endl ;      return 0 ; }