【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 ...
随机推荐
- java程序: 从kernel.ubuntu.com下载kernel - HttpURLConnection
用java实现从kernel.ubuntu.com下载内核的小工具 现在的最新的LTS版本是4.19,目前已经更新到4.19.13了. Kernel的更新通知里,经常有下面的陈述: 作为一个听劝的人, ...
- vim 安装vundle 之curl
百度出来的博客文章,配置curl.cmd 的内容win7 x64 好像有误 贴下正确的 @rem Do not use "echo off" to not affect any c ...
- foreach的基本语法
有一个布尔型循环是专门用来循环数组的.这个循环的基本语法就是foreach基本语法 foreach( 要循环的数组变量 as [键变量 =>] 值变量){ //循环的内容 } 这是一个固定用法, ...
- Spring @Resource, @Autowired and @Inject 注入
Overview I’ve been asked several times to explain the difference between injecting Spring beans with ...
- Prime Numbers in a Grid素数网格
&/@ Shorthand notation for Map If[PrimeQ[#], Framed@Style[#, Orange, Bold, 15], #] & /@ Rang ...
- 使用 profile 进行python代码性能分析
定位程序性能瓶颈 对代码优化的前提是需要了解性能瓶颈在什么地方,程序运行的主要时间是消耗在哪里,对于比较复杂的代码可以借助一些工具来定位,python 内置了丰富的性能分析工具,如 profile,c ...
- 导出word的另类做法
一.背景 项目中经常有导出word的功能,一般用poi来做,但在要求外观较高的情况下,用poi来做基本不能满足需求 而事实上word除了我们一般使用的模式外,还存在xml.与html模式(你没看错,右 ...
- Siebel Tools client安装假死在92%问题解决
Solution to this error: This issue happens incase of installation is on unsupported operating system ...
- 数据库系统异常排查之DMV(转)
来源: http://www.cnblogs.com/fygh/archive/2012/03/12.html 数据库系统异常是DBA经常要面临的情景,一名有一定从业经验的DBA,都会有自己一套故障排 ...
- 新发布 | Azure镜像市场正式上线
由世纪互联运营的 Azure 镜像市场于2016年9月21日正式落地中国市场,在客户和软件开发商间搭建起了一站式门户.来自全球和本地领先软件开发商并基于 Azure 的云应用.云服务和解决方案在门户中 ...