首页 > 其他 > 详细

杭电acm find your present (2)

时间:2015-05-23 11:10:20      阅读:258      评论:0      收藏:0      [点我收藏+]

题目地址:http://acm.hdu.edu.cn/game/entry/problem/show.php?chapterid=1&sectionid=2&problemid=11

使用异或,有个注意的问题就是不能使用cin,实在是太慢了。

c++ 源码:

#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n)==1&&n!=0){
        int res=0,b;
        for(int i=0;i<n;i++){
            scanf("%d",&b);
            res =res^b;
        }
        printf("%d\n",res);
    }
    return 0;
}

 

杭电acm find your present (2)

原文:http://www.cnblogs.com/jackwuyongxing/p/4523742.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!