【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 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.
输入
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.
输出
The name of the lost sock.
样例输入
2
aabcdef
bzyxwvu
bzyxwvu
4
aqwerty
eas fgh
aqwerty
easdfgh
easdfgh
aqwerty
aqwerty
2
0x0abcd
0ABCDEF
0x0abcd
样例输出
aabcdef
eas fgh
0ABCDEF
提示
Because of HUGE input, scanf is recommended.
#include<bits/stdc++.h>
using namespace std;
],x[],ch;
int main()
{
int i,j,n;
while(scanf("%d",&n)!=EOF)
{
memset(a,,sizeof(a));
getchar();
;i<=*n-;i++)
{
;j<;j++)
{
ch=getchar();
x[j]=ch;
a[j]^=x[j];
}
getchar();
}
a[]='\0';
printf("%s\n",a);
}
;
}
【TOJ 3812】Find the Lost Sock(异或)的更多相关文章
- 【整理】XOR:从陌生到头晕
一:解决XOR常用的方法: 在vjudge上面输入关键词xor,然后按照顺序刷了一些题. 然后大概悟出了一些的的套路: 常用的有贪心,主要是利用二进制的一些性质,即贪心最大值的尽量高位取1. 然后有前 ...
- 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 ...
- zimbra6同域名与同hostname与同系统异机恢复
系统:redhat5.4_64 安装DNS:[root@test6 ~]# yum install bind -y[root@test6 ~]# yum install bind-chroot -y[ ...
- Android数据加密之异或加密算法
前言: 这几天被公司临时拉到去做Android IM即时通信协议实现,大致看了下他们定的协议,由于之前没有参与,据说因服务器性能限制,只达成非明文传递,具体原因我不太清楚,不过这里用的加密方式是采用异 ...
- Oracle数据库异机升级
环境: A机:RHEL5.5 + Oracle 10.2.0.4 B机:RHEL5.5 需求: A机10.2.0.4数据库,在B机升级到11.2.0.4,应用最新PSU补丁程序. 目录: 一. 确认是 ...
- [LeetCode] Maximum XOR of Two Numbers in an Array 数组中异或值最大的两个数字
Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum re ...
- [PHP][位转换积累]之异或运算的简单加密应用
异或的符号是^.按位异或运算, 对等长二进制模式按位或二进制数的每一位执行逻辑按位异或操作. 操作的结果是如果某位不同则该位为1, 否则该位为0. xor运算的逆运算是它本身,也就是说两次异或同一个数 ...
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
有时候,当我们使用"mysql"."mysqladmin"."mysqldump"等命令管理数据库时,服务器抛出类似如下错误: 一.错误现场 ...
- Poj The xor-longest Path 经典题 Trie求n个数中任意两个异或最大值
Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 5646 Accepted: 1226 Description In an ...
随机推荐
- 1.zookeeper的安装
1.解压zk压缩包 tar -zxvf (zk压缩包路径名) -C (解压目标目录路径) 2.在zk解压目录下新建data文件夹 mkdir data 3.在data文件夹下新建myid vi myi ...
- Csharp:asp.net CheckBoxList databind
/// <summary> /// CheckBoxList數據源 /// 塗聚文 /// 20130705 /// /// </summary> private void s ...
- scss-@mixin
@mixin指令用于定义混入,它包括任选的变量和参数中的mixin名称后. scss简单示例: @mixin style { .cont{ color: #77C1EF; } } @include s ...
- dhtml
网页换肤:<div> <button>red</button> <button>blue</button> <button>bl ...
- ArcGIS图框生成和批量打印工具 5.2支持国家2000坐标系,支持ArcGIS10.1、ArcGIS10.2,输出图片可以是TIF和JPG
主要两个功能有:生成图框.批量输出MXD和JPG http://files.cnblogs.com/gisoracle/ScalePrint.rar 1. 批量生成标准分幅图或行政区划, ...
- Resharper安装及激活--转载
原文地址:ReSharper2018破解详细方法 1.先安装好Resharper: 2.下载完补丁后解压,以管理员身份运行Patch.cmd,如下图所示,即破解成功: 3.打开VS,打开ReSha ...
- wx.grid 简单例子
import wx, wx.grid class GridData(wx.grid.PyGridTableBase): _cols = "a b c".split() _data ...
- Id_Name
<bean name="u" class="com.bjsxt.dao.impl.UserDAOImpl"></bean> <be ...
- zan-framework mysql连接
①根据文档内容要配置sqlmap连接池的读写白名单 http://doc.zanphp.io/zh/libs/connection_pool.html 示例代码 // demo.demo.demo_s ...
- LeetCodeOJ刷题之14【Longest Common Prefix】
Longest Common Prefix Write a function to find the longest common prefix string amongst an array of ...