ZOJ3432 Find the Lost Sock 字符串异或
来源:互联网 发布:linux下怎么看java目录 编辑:程序博客网 时间:2024/05/17 23:49
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4116
题目大意:有n双袜子中的2n-1只,每只袜子都有一个长度为7个字符的名字,现在让你找出缺少的那只袜子的名字。
分析:将所有的袜子名字异或起来,那么最后得到的答案就是只有一只的袜子的名字,直接输出即可。
实现代码如下:
#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<string>#include<queue>#include<algorithm>#include<map>#include<iomanip>#define INF 99999999using namespace std;const int MAX=10;char s1[MAX],s2[MAX];int main(){int n;while(cin>>n){memset(s2,0,sizeof s2);getchar();for(int i=0;i<2*n-1;++i){gets(s1);for(int j=0;j<7;++j)s2[j]^=s1[j];}puts(s2);}return 0;}
0 0
- ZOJ3432 Find the Lost Sock 字符串异或
- ZOJ3432 Find the Lost Sock,异或运算
- ZOJ3432 Find the Lost Sock(异或运算)
- zoj3432 Find the Lost Sock 亦或的运用
- zoj3432——Find the Lost Sock
- 异或解题:Find the Lost Sock
- ZOJ3432字符串异或
- 1416: Find the Lost Sock
- zoj 3432 Find the Lost Sock
- zoj 3432 Find the Lost Sock
- ZOJ 3432 Find the Lost Sock
- ZOJ 3432 Find the Lost Sock
- ZCMU-1416-Find the Lost Sock
- zoj 3432 Find the Lost Sock(解决时间超时问题)
- ZOJ 3432 Find the Lost Sock 解题报告
- ZOJ 3432 Find the Lost Sock(模拟)
- zoj 3432 Find the Lost Sock(zoj月赛,受打击了 = =)
- ZOJ 3432 Find the Lost Sock
- 负载均衡简単概念
- Linux命令之管道
- svm中的数学和算法
- whatsapp显示不全联系人怎么办
- 每天一个linux命令(25):linux文件属性详解
- ZOJ3432 Find the Lost Sock 字符串异或
- Html 图像
- Leetcode88: Gray Code
- 转载,写的不错的一个关于dshow的文章
- angularjs基础—$scope.$apply的应用
- C# 调用CMD
- 基于Arm板linux嵌入式系统RS485串口读写通讯
- linux中用命令mail发送邮件
- Android 自定义控件实现ListView索引