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. C# 匿名对象 增加属性

    dynamic data = new System.Dynamic.ExpandoObject(); IDictionary<string, object> dictionary = (I ...

  2. Eclipse 导入逆向工程

    相关配置 生成 生产前 生成后

  3. the nearest point/vertex point of linestring

    引用https://github.com/Toblerity/Shapely/issues/190 snorfalorpagus commented on 18 Oct 2014 The point ...

  4. Python 标准库、第三方库

    Python 标准库.第三方库 Python数据工具箱涵盖从数据源到数据可视化的完整流程中涉及到的常用库.函数和外部工具.其中既有Python内置函数和标准库,又有第三方库和工具.这些库可用于文件读写 ...

  5. 快速排序和二分查找(Java)

    import java.util.Arrays; public class Main { public static void main(String[] args) { int[] data = { ...

  6. Zookeeper(一)客户端

    Zookeeper-客户端 例子: // org.apache.zookeeper.ZooKeeperMain public class ZooKeeperMain { public static v ...

  7. TCP定时器 之 重传/延迟ACK/保活 定时器初始化

    创建socket时会创建传输控制块,之后调用初始化函数对控制块进行初始化,其中包括对定时器的初始化,tcp会调用tcp_init_xmit_timers函数来初始化这些定时器,本文将详细分析tcp_i ...

  8. leetcode 56区间合并

    class Solution { public: static bool cmp(vector<int> a,vector<int> b){ ]<b[]; } vecto ...

  9. hadoop 配置注意

    到目前为止,关于配置1.*版本的hadoop书籍占多数,前面配置2.*失败以后照着书籍配置1.2.1成功. 准备工具:(注意用统一位数的,我的64位) hadoop1.2.1 jdk1.6 xshel ...

  10. Java -- 通过 URLConnection 进行http请求中文乱码

    对writer和reader指定字符集 out = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "utf-8 ...