コード例 #1
0
ファイル: acme.c プロジェクト: Ankurrana/cfiles_basics
int main(){
	int common,i,m,n,s[110],t[110],testcases = 0,k = 0;
	testcases = scan2();
	while(testcases--){
		common = 0;
		k = 0;
		m = 0;
		n = 0;
		
		m = scan2();
		for(i=0;i<m;i++)
			s[i] = scan2();
		
		n = scan2();

		for(i=0;i<n;i++)
			t[i] = scan2();


		common = printIntersection(s,t,m,n);
		

		if(m>=n)
			k = m;
		else
			k = n;

		printf("%d\n",k-common);
	}
	return 0;
}
コード例 #2
0
int main(int argc, char** argv) {
  int a1[] = {7, 1, 5, 2, 3, 6};
  int a2[] = {3, 8, 6, 20, 7};
  const uint m = sizeof(a1)/sizeof(a1[0]);
  const uint n = sizeof(a2)/sizeof(a2[0]);
  cout << "Union of two arrays is \n";
  printUnion(a1, a2, m, n);
  cout << "\nIntersection of two arrays is \n";
  printIntersection(a1, a2, m, n);
  return 0;
}