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 ...
随机推荐
- ping —— 虚拟机
1. 主机ping 虚拟机 ping 不通 设置——虚拟机—— 防护墙——入站规则—— 文件和打印共享 (回显请求-ICMPv4-In) 2.主机连接不上虚拟机中的sqlsrver 设置— ...
- 关键字static在标准C/C++的作用
static总结:根据作用域,存储域,生命周期3点来说 static含义: 是C/C++中很常用的修饰符,它被用来控制变量的存储方式和可见性. (1)标准C语言中,static的最主要功能是隐藏,其次 ...
- classpath说明
概念解释: classpath : 即项目中WEB-INF下面的classes目录; 应用: [01] src路径下的文件在编译后会放到WEB-INF/classes路径下.默认的classpath是 ...
- kaliXSSbeef的使用
Kali中Beef的安装和使用: 先打开终端输入 apt-get install beef-xss 然后切换到beef的安装目录 cd /usr/share/beef-xss 然后启动beef ./b ...
- tp5获取器的用法。
1.命名规则 get + 属性名的驼峰命名+ Attr ------>在相应的model中创建方法 例如: protected function getSexAttr($value ...
- Java——利用反射机制将表单数据自动填充到JavaBean中
以一个案例介绍反射机制的一种常见的使用场景,以及具体实现. 1.本文案例 在编写Java Web应用程序时,使用表单提交数据是一个必不可少的环节,后台对于前台使用表单提交的数据需要能够从请求中解析,并 ...
- scala Futures and Promises
http://docs.scala-lang.org/overviews/core/futures.html Futures and Promises By: Philipp Haller, A ...
- leetcode-easy-dynamic-53 Maximum Subarray
mycode 66.85% class Solution(object): def maxSubArray(self, nums): """ :type nums: L ...
- Gson解析list类型的json串
Gson gson = new Gson(); Type type = new TypeToken<List<Object>>() {}.getType(); List< ...
- BOSCH汽车工程手册————自适应巡航速度控制ACC
驾驶员通过自动速度控制器操纵键,将汽车行驶速度控制在预设的期望速度上. ACC系统则在自动速度控制的基础上检测本车到前面行驶汽车的距离以及相对速度,以及其他车道上的信息. 利用这些数据就能控制两车之间 ...