Who will be punished

Problem Description

This time,suddenly,teacher Li wants to find out who have missed interesting DP lesson to have fun.The students who are found out will get strictly punishment.Because,teacher Li wants all the students master the DP algorithm.
However,Li doesn't want to waste the class time to call over the
names of students.So he let the students to write down their names in one
paper.To his satisfaction,this time, only one student has not come.
He can
get the name who has not come to class,but,it is troublesome,and,teacher always
have many things to think about,so,teacher Li wants you, who is in the ACM team,
to pick out the name.

Input

The first line of each case have one positive integer N.N is
the number of the students,and N will not greater than
500,000.
Then,following N lines,each line contains one name of students who
have attended class.The N-1 lines are presented after N lines.These N-1 lines
indicates the names of students who have come to class this time,one name in one
line.
The length of student's name is not greater than 30.

Output

output the name of the student who have not come to class.

Sample Input

3
A
B
C
B
C

Sample Output

A

解释:

找到只出现过一次的人的名字,而其他人都出现了两次。那么用一个字符串去异或,异或。毕竟东一个名字的,出现两次,那么两次的相同位置的字符肯定是一样。

 #include<stdio.h>
#include<string.h>
int main()
{
void fun(int n);
int n;
while(scanf("%d",&n)!=EOF)
fun (n);
return ;
}
void fun (int n)
{ int j,i,a;
char str1[],str2[];
n=n*;
for(i=;i<;i++)
str2[i]=;
for(i=;i<n;i++)
{
gets(str1);
a=strlen(str1);
for(j=;j<a;j++)
str2[j]=str1[j]^str2[j];
}
puts(str2);
}

Who will be punished的更多相关文章

  1. Bestcoder#5 1002

    Bestcoder#5 1002 Poor MitsuiTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (J ...

  2. An Unfair Game-[ACdream1035]

    Problem Description There are n people and n target, everyone should get one target, no two people g ...

  3. 2016年12月26日 星期一 --出埃及记 Exodus 21:21

    2016年12月26日 星期一 --出埃及记 Exodus 21:21 but he is not to be punished if the slave gets up after a day or ...

  4. 2016年12月25日 星期日 --出埃及记 Exodus 21:20

    2016年12月25日 星期日 --出埃及记 Exodus 21:20 "If a man beats his male or female slave with a rod and the ...

  5. [ACM_水题] Yet Another Story of Rock-paper-scissors [超水 剪刀石头布]

    Description Akihisa and Hideyoshi were lovers. They were sentenced to death by the FFF Inquisition. ...

  6. AngularJS Providers 详解

    供应者(Providers) Each web application you build is composed of objects that collaborate to get stuff d ...

  7. spotify engineering culture part 1

    原文 ,因为原视频说的太快太长, 又没有字幕,于是借助youtube,把原文听&打出来了. 中文版日后有时间再翻译. one of the big succeess factors here ...

  8. HDU4887_Endless Punishment_BSGS+矩阵快速幂+哈希表

    2014多校第一题,当时几百个人交没人过,我也暴力交了几发,果然不行. 比完了去学习了BSGS才懂! 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4887 ...

  9. zjuoj 3610 Yet Another Story of Rock-paper-scissors

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3610 Yet Another Story of Rock-paper-sc ...

随机推荐

  1. ie文件断点续传

    一.概述 所谓断点续传,其实只是指下载,也就是要从文件已经下载的地方开始继续下载.在以前版本的HTTP协议是不支持断点的,HTTP/1.1开始就支持了.一般断点下载时才用到Range和Content- ...

  2. 【杂题】[AGC034D] Manhattan Max Matching【费用流】

    Description 有一个无限大的平面,有2N个位置上面有若干个球(可能重复),其中N个位置是红球,N个位置是蓝球,红球与蓝球的总数均为S. 给出2N个位置和上面的球数,现要将红球与蓝球完美匹配, ...

  3. 1502: [NOI2005]月下柠檬树

    一堆圆台平行光的投影 在草稿纸上画一下,发现对于一个圆,它投影完还是一个半径不变的圆. 定义树的轴在投影平面上经过的点为原点,定一个正方向,建立平面直角坐标系, 能发现,对于一个半径为\(r\),高度 ...

  4. netty实现客户端服务端心跳重连

    前言: 公司的加密机调度系统一直使用的是http请求调度的方式去调度,但是会出现网络故障导致某个客户端或者服务端断线的情况,导致很多请求信息以及回执信息丢失的情况,接着我们抛弃了http的方式,改为T ...

  5. 微信小程序_(组件)picker

    picker组件效果 官方文档:传送门 Page({ data: { array: ['美国', '中国', '巴西', '日本'], objectArray: [ { id: 0, name: '美 ...

  6. pygame基本框架

    代码: import sys #导入sys模块import pygame #导入pygame模块 pygame.init() #pygame初始化size = width,height = 800,8 ...

  7. redis在分布式中的使用

    作者:孤独烟 来自:http://rjzheng.cnblogs.com/ 为什么要用redis:为了并发和性能,使用redis做为缓冲 使用redis有什么缺点 主要是四个问题 (一)缓存和数据库双 ...

  8. gulp自动化构建工具安装使用(1)

    我用的是windows,所以以下操作针对于windows用户,其他系统有不一样的地方请自行查阅资料更正. 好了,废话少说,反正也就是随手捣腾.下雨了,天晴了,我们开始搞gulp了 安装:gulp是个构 ...

  9. Scala学习(三)——集合

    基本数据结构 Scala提供了一些不错的集合. 数组 Array 数组是有序的,可以包含重复项,并且可变. val numbers = Array(1, 2, 3, 4, 5, 1, 2, 3, 4, ...

  10. 有关ajax中的URL问题

    url  :  ../../Service/MSD_Maintain.ashx/?action=Add4T2 url  :  Handler/MaintainHandler.ashx/?action= ...