Who will be punished
Who will be punished
Problem Description
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 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
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的更多相关文章
- Bestcoder#5 1002
Bestcoder#5 1002 Poor MitsuiTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (J ...
- An Unfair Game-[ACdream1035]
Problem Description There are n people and n target, everyone should get one target, no two people g ...
- 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 ...
- 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 ...
- [ACM_水题] Yet Another Story of Rock-paper-scissors [超水 剪刀石头布]
Description Akihisa and Hideyoshi were lovers. They were sentenced to death by the FFF Inquisition. ...
- AngularJS Providers 详解
供应者(Providers) Each web application you build is composed of objects that collaborate to get stuff d ...
- spotify engineering culture part 1
原文 ,因为原视频说的太快太长, 又没有字幕,于是借助youtube,把原文听&打出来了. 中文版日后有时间再翻译. one of the big succeess factors here ...
- HDU4887_Endless Punishment_BSGS+矩阵快速幂+哈希表
2014多校第一题,当时几百个人交没人过,我也暴力交了几发,果然不行. 比完了去学习了BSGS才懂! 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4887 ...
- 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 ...
随机推荐
- idea2018.3.6安装与破解教程(亲测可用、破解到2100年)
最近,帮室友进行idea安装,之前自己安装借鉴的博客已404,在网上找了好几个都无效,想着总结一份备用. 此博客是又找了一台电脑,边安装边写的. 目录 (已安装好的,可以直接看idea2018.3.6 ...
- HDU 2829 [Lawrence] DP斜率优化
解题思路 首先肯定是考虑如何快速求出一段铁路的价值. \[ \sum_{i=1}^k \sum_{j=1, j\neq i}^kA[i]A[j]=(\sum_{i=1}^kA[i])^2-\sum_{ ...
- A. Detective Book
A. Detective Book time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- 对象转JSON字符串与json字符串转对象方法
JSON.stringify()[从一个对象中解析出字符串] JSON.parse()[从一个json字符串中解析出对象] var data = {"nums": 1, " ...
- 分布式-信息方式-ActiveMQ示例
实战 代码如下: 信息生产者 package test.mq.helloword; import javax.jms.Connection; import javax.jms.ConnectionFa ...
- eclipse中取消自动生成的TODO Auto-generated method stub
我们在实现接口定义的方法.Eclipse往往会自动加上一句:TODO Auto-generated method stub 每次手动删除很麻烦,我们可以设置一下,让强大的Eclipse在完成自动代码时 ...
- Spring之AOP配置
特别提示:本人博客部分有参考网络其他博客,但均是本人亲手编写过并验证通过.如发现博客有错误,请及时提出以免误导其他人,谢谢!欢迎转载,但记得标明文章出处:http://www.cnblogs.com/ ...
- 后盾网lavarel视频项目---lavarel用户认证实例
后盾网lavarel视频项目---lavarel用户认证实例 一.总结 一句话总结: 主要是用的Auth认证,所以配置是配置的auth(config/auth.php),控制器中调用也是用的Auth( ...
- leetcode-easy-math-326. Power of Three
mycode class Solution(object): def isPowerOfThree(self, n): """ :type n: int :rtype: ...
- CentOS 6.4编译安装和部署Zabbix 2.0版本监控(中文)
[一].zabbix简介 zabbix是一个基于web界面的提供分布式系统监视以及网络监视功能的企业级开元解决方案 zabbix由2部分构成,zabbix_server和可选组件zabbix_agen ...