HDU_2095find your present (2)
来源:互联网 发布:电动汽车数据采集 编辑:程序博客网 时间:2024/05/21 22:56
http://acm.hdu.edu.cn/showproblem.php?pid=2095
本题如果知道位运算那么将十分简单,其中需要用到^(异或符)。
真异或假的结果是真,假异或真的结果也是真,真异或真的结果是假,假异或假的结果是假。就是说两个值不相同,则异或结果为真。反之,为假。 不同为1,相同为0,如1001异或1010等于0011.(来自百度百科http://baike.baidu.com/view/674171.htm)
另有 a^b^c=a^(b^c)成立。
#include <stdio.h>int main(){ int result,n,t; while(scanf("%d",&n)!=EOF&&n) { result=0; for(int i=0;i<n;++i) { scanf("%d",&t); result^=t; } printf("%d\n",result); }}
- HDU_2095find your present (2)
- find your present (2)
- find your present (2)
- hdu2095find your present (2)
- find your present (2)
- find your present (2)
- find your present (2)
- find your present (2)
- find your present (2)
- find your present(2)
- hdoj2095find your present (2)
- hdu2095find your present (2)
- HDU2095find your present (2)
- find your present (2)
- HDU2095find your present (2)
- find your present (2)
- find your present (2)
- find your present (2)
- 黑马程序员--数据库开发及ADO.NET学习总结
- nfs挂载
- 开源免费天气预报接口API以及全国所有地区代码!!(国家气象局提供)
- 裸机调试-led,蜂鸣器,按键
- 裸机调试----定时器
- HDU_2095find your present (2)
- 超分资源
- 裸机调试----中断
- hdu4335 What is N?------多校联合4
- 裸机调试------定时器中断
- 利用过滤器判断用户访问权限
- mmap直接控制底层
- 数据契约(DataContract)
- 需求,需求分析为什么这么难?