题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6560 参考题解:https://blog.csdn.net/timeclimber/article/details/96280798 一开始以为是数据结构题,在训练时卡其他题,就没做这道,看了题解后不得不惊叹,原来题目正解,本身可以这么简单,证明也很好理解。
#include
using namespace std;
int main()
{
int t,cas=1;scanf("%d",&t);
while(t--){
int n;
scanf("%d",&n);
int ans=0;
for(int i=1,x;i2&&x>2) ans^=(x-2);
}
printf("Case %d: %d\n",cas++,ans);
}
return 0;
}