CF1270C Make Good

众所周知,(2 imes(xorotimes xorotimes(sum+xor))=sum+xor+(sum+xor))

code:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll s;
	int t,n,a,x;
	scanf("%d",&t);
	while(t--)
	{
		s=x=0;
		scanf("%d",&n);
		while(n--)
		{
			scanf("%d",&a);
			x^=a;
			s+=a;
		}
		printf("2
%d %I64d
",x,x+s);
	}
	return 0;
}
原文地址:https://www.cnblogs.com/May-2nd/p/14449071.html