【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 ...
随机推荐
- PAT 1021 Deepest Root
#include <cstdio> #include <cstdlib> #include <vector> using namespace std; class ...
- JSON初试
本次在课堂上老师教我使用JSON. 本次的教学网站是:https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON?td ...
- 前端之CSS——CSS选择器
一.CSS介绍 为什么需要CSS(CSS的作用)? 在没有CSS之前,我们想要修改HTML元素的样式需要为每个HTML元素单独定义样式属性,当HTML内容非常多时,就会定义很多重复的样式属性,并且修改 ...
- Nginx管理(二)
一.Nginx虚拟主机 一个web服务器软件默认情况下只能发布一个web,因为一个web分享出去需要三个条件(IP.Port.Domain name) Nginx虚拟主机实现一个web服务器软件发布多 ...
- 原生js实现雪花飘落效果
雪花飘落的效果实现步骤:1.使用setInterval定时器每800毫秒创建一个雪花:2.把每一个雪花作为参数传进动态下落的方法中即可. <style> *{padding: 0;marg ...
- @PathVariable @RequestParam @RequestBody等参数绑定注解详解
一.分类 handler method 参数绑定常用的注解,我们根据他们处理的Request的内容不同分为四类: 处理request uri 部分的注解: @PathVariable;(这里指ur ...
- xshell连不上虚拟机linux的解决办法
1.找到Linux系统的ip地址 输入命令 ifconfig 2.打开本地网络连接 将VMnet1的ip地址设置为和虚拟机ip同一网段的ip 比如虚拟机Linux系统的ip为 192.168. ...
- Linux CentOS如何汉化系统
su root切换为root用户 写入环境变量 echo "export LANG="zh_CN.UTF8"">>/etc/profile sour ...
- C语言指针的陷阱
C语言指针的陷阱 分类: C/Cpp 转自:http://blog.csdn.net/porscheyin/article/details/3461670 “C语言诡异离奇,陷阱重重,却获得了巨大 ...
- wxpyhon 对话框
Python内置了好多定义好了的对话框供我们使用,这里先介绍三个最常用的: 1 Message dialog 2 Text entry 3 Choosing from a list 当然python还 ...