nefu643teacher Li【字符位异或】

很久以前的题了,翻看自己林大oj的没A的题,看到这个,貌似是上学期孙大神出的周赛的题,怎么拖了这么久orz,现在看来就是小case嘛,就像去年那会做bestcoder,第二个题根本就做不出,现在憋一个多小时也能1A了

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

There are several test cases.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.
   Process to the end of file.

output

 For each test case, first print a line saying "Scenario #k", where k is the number of the test case.Then output the name of the student who have not come to class.One case per line.Print a blank line after each test case, even after the last one.

sample_input

3
A
B
C
B
C

sample_output

Scenario #1
A
/************
nefu643
2016.1.3
828k 571ms C++ (g++ 3.4.3) 483
************/
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n;
int main()
{
    int cas=1;
    while(~scanf("%d",&n))
    {
        char name[40],tmp[40];
        memset(name,0,sizeof(name));
        for(int i=1;i<=2*n-1;i++)
        {
            scanf("%s",tmp);
            for(int j=0;j<40;j++)
                name[j]=name[j]^tmp[j];
        }
        printf("Scenario #%d\n",cas++);
        printf("%s\n",name);
    }
    return 0;
}


你可能感兴趣的:(nefu643teacher Li【字符位异或】)