可以保存为count.sh运行 ./count.sh your_name
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
可以保存为count.sh运行 ./count.sh your_name
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
http://acm.hust.edu.cn:8080/judge/problem/viewProblem.action?id=18669
http://acm.sgu.ru/problem.php?contest=0&problem=275
time limit per test: 0.5 sec.
memory limit per test: 65536 KB
input: standard
output: standard
The sequence of non-negative integers A1, A2, …, AN is given. You are to find some subsequence Ai1, Ai2, …, Aik(1 <= i1< i2< … < ik<= N) such, that Ai1XOR Ai2XOR … XOR Aikhas a maximum value.
The first line of the input file contains the integer number N (1 <= N <= 100). The second line contains the sequence A1, A2, …, AN (0 <= Ai <= 1018).
Write to the output file a single integer number – the maximum possible value of Ai1XOR Ai2XOR … XOR Aik.
3 11 9 5
14
从n个数中选出若干个使得异或的值最大
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
幼儿园有g个女孩和b个男孩,同性之间互相认识,而且男孩和女孩之间有的也互相认识。现在要选出来最多的孩子,他们之间都互相认识。
一道基础的二分图最大独立集问题。
二分图的最大独立集 = n-最小覆盖集 = n-完美匹配数。
所以就转化成了二分图匹配,用匈牙利算法实现即可。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|