首页 > 代码库 > HDU 5650 so easy
HDU 5650 so easy
http://acm.hdu.edu.cn/showproblem.php?pid=5650
数学规律
如果只有一个数 输出
多个数 由于异或运算满足交换律 S的所有子集的元素异或 那么原子元素出现的次数是2^(n-1) 一定是偶数 那么异或的结果是0
1 #include <iostream> 2 #include <bits/stdc++.h> 3 4 using namespace std; 5 6 int main() 7 { 8 int T; 9 cin >> T; 10 while (T--) 11 { 12 int n; 13 int ans; 14 cin >> n; 15 for(int i = 0; i < n; i++) 16 { 17 cin >> ans; 18 } 19 if (n == 1) cout << ans << endl; 20 else cout << 0 << endl; 21 } 22 return 0; 23 }
HDU 5650 so easy
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。