###### UVa 496 Simply Subsets (STL&set_intersection)

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=437

set_intersection(a, a + n, b, b + m, v.begin());

/*0.016s*/

#include<bits/stdc++.h>
using namespace std;

int a[100], b[100];
vector<int> v(100);///初始化空间是必须的

int main()
{
int n, m, cnt, diff;
char ch;
while (~scanf("%d%c", &a[0], &ch))
{
for (n = 1; ch != 10; ++n)
scanf("%d%c", &a[n], &ch);
cnt = scanf("%d%c", &b[0], &ch);
for (m = 1; ch != 10 && cnt == 2; ++m)
cnt = scanf("%d%c", &b[m], &ch);
sort(a, a + n);
sort(b, b + m);
diff = set_intersection(a, a + n, b, b + m, v.begin()) - v.begin();
if (diff == min(n, m))
{
if (n < m) puts("A is a proper subset of B");
else if (n > m) puts("B is a proper subset of A");
else puts("A equals B");
}
else if (diff) puts("I'm confused!");
else puts("A and B are disjoint");
}
return 0;
}


#### UVa 496 - Simply Subsets

2014-07-06 01:30:23

#### UVA 496 - Simply Subsets

2018-03-20 16:43:38

#### uva题目分类

2011-07-24 00:34:22

#### UVA 408 - Uniform Generator

2018-03-22 14:02:16

#### UVA 694 - The Collatz Sequence

2018-03-22 15:17:18

#### UVA 371 - Ackermann Functions

2018-03-22 14:58:02

#### UVA 382 - Perfection

2018-03-20 14:29:33

#### UVA 1588

2016-09-04 20:25:54

#### UVA 12576 Simply Loopy

2015-11-29 10:52:29

#### uva难度表

2013-04-05 16:42:34

## 不良信息举报

UVa 496 Simply Subsets (STL&set_intersection)