ZOJ 3432 Find the Lost Sock (异或的运用)
Alice bought a lot of pairs of socks yesterday. But when she went home, she found that she has lost one of them. Each sock has a name which contains exactly 7 charaters.
Alice wants to know which sock she has lost. Maybe you can help her.
Input
There are multiple cases. The first line containing an integer n (1 <= n <= 1000000) indicates that Alice bought n pairs of socks. For the following 2*n-1 lines, each line is a string with 7 charaters indicating the name of the socks that Alice took back.
Output
The name of the lost sock.
Sample Input
2
aabcdef
bzyxwvu
bzyxwvu
4
aqwerty
eas fgh
aqwerty
easdfgh
easdfgh
aqwerty
aqwerty
2
0x0abcd
0ABCDEF
0x0abcd
Sample Output
aabcdef
eas fgh
0ABCDEF
题意:
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
#include<memory.h>
using namespace std;
char s[],c;
int main()
{
int n;
while(~scanf("%d\n",&n)){
for(int i=;i<=;i++) s[i]='\0';
for(int i=;i<*n;i++){
for(int j=;j<;j++){
c=getchar();
s[j]=s[j]^c;
}
}
printf("%s",s);
}
return ;
}
ZOJ 3432 Find the Lost Sock (异或的运用)的更多相关文章
- 【整理】XOR:从陌生到头晕
一:解决XOR常用的方法: 在vjudge上面输入关键词xor,然后按照顺序刷了一些题. 然后大概悟出了一些的的套路: 常用的有贪心,主要是利用二进制的一些性质,即贪心最大值的尽量高位取1. 然后有前 ...
- (二进制 异或)Team Formation --ZOJ --3870
链接: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3870 http://acm.hust.edu.cn/vjudge/ ...
- 【TOJ 3812】Find the Lost Sock(异或)
描述 Alice bought a lot of pairs of socks yesterday. But when she went home, she found that she has lo ...
- ZOJ - 3870 Team Formation(异或)
题意:给定N个数,求这N个数中满足A ⊕ B > max{A, B})的AB有多少对.(A,B是N中的某两个数) 分析: 1.异或,首先想到转化为二进制. eg:110011(A)和 1(B)- ...
- 位运算 ZOJ 3870 Team Formation
题目传送门 /* 题意:找出符合 A^B > max (A, B) 的组数: 位运算:异或的性质,1^1=0, 1^0=1, 0^1=1, 0^0=0:与的性质:1^1=1, 1^0=0, 0^ ...
- 【转载】图论 500题——主要为hdu/poj/zoj
转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并 ...
- ZOJ 3529 A Game Between Alice and Bob(博弈论-sg函数)
ZOJ 3529 - A Game Between Alice and Bob Time Limit:5000MS Memory Limit:262144KB 64bit IO For ...
- zimbra6同域名与同hostname与同系统异机恢复
系统:redhat5.4_64 安装DNS:[root@test6 ~]# yum install bind -y[root@test6 ~]# yum install bind-chroot -y[ ...
- ZOJ Problem Set - 3593 拓展欧几里得 数学
ZOJ Problem Set - 3593 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3593 One Person ...
随机推荐
- stack_01
A.添加/移除 A.1.void stack::push(elemValue); // 栈头 添加元素 A.2.void stack::pop(); // 栈头 移除第一个元素 B.随机存取 C.数据 ...
- Python爬虫Urllib库的基本使用
Python爬虫Urllib库的基本使用 深入理解urllib.urllib2及requests 请访问: http://www.mamicode.com/info-detail-1224080.h ...
- Python 爬虫-获得大学排名
2017-07-29 23:20:24 主要技术路线:requests+bs4+格式化输出 import requests from bs4 import BeautifulSoup url = 'h ...
- 3-29 params的理解; Active Model Errors; PolymorphicRoutes 多态的路径; ::Routing::UrlFor
params的理解和作用: http://api.rubyonrails.org/classes/ActionController/Parameters.html#method-i-require A ...
- 原生js实现选项卡
html代码: <div class="tab"> <ul> <li class="selected">图片</li& ...
- Mishka and Divisors CodeForces - 703E
大意: 给定$n$个数, 求选择最少的数满足积为$k$的倍数, 并且和最小 刚开始想着暴力维护$k$的素因子向量, 用map转移, 结果T了. 看了下别的dala0题解, 不需要考虑素因子, 我们考虑 ...
- uva-11426-数论
https://vjudge.net/problem/UVA-11426#author=0 求 SUM{ gcd(i,j) | 1<=i<j<=n}, n<4000001. 令 ...
- Oracle EBS供应商接口导入(转)
原文地址 Oracle EBS供应商接口导入 1.供应商导入组成供应商导入主要分为供应商头信息导入.供应商地点信息导入.供应商联系人导入三个部分的信息,其他按实际需求进行添加.供应商头信息导入:导入供 ...
- Activiti工作流笔记(4)
Activiti工作流启动流程 /** * 启动流程 * */ public class ActivitiTest2 { RepositoryService repositoryService; Ru ...
- OC MRC之计数器的基本操作(代码分析)
/* 1.方法的基本使用 1> retain :计数器+1,会返回对象本身 2> release :计数器-1,没有返回值 3> retainCount :获取当前的计数器 4> ...