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 ...
随机推荐
- (转)Spring实例化
标签:SpringContextUtil,getBean 手动获取Bean 方法一 不用配置xml,直接java代码实现 /** * 工厂模式选择Bean类 */ public class MyBe ...
- POJ 1149 猪圈买猪 建图太强大!! 没有透彻领悟 慢慢消化
PIGS Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19575 Accepted: 8948 Description ...
- 614A - Link/Cut Tree 数乘
A. Link/Cut Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- 捕获有问题的SQL
- JavaWeb_(SSH论坛)_七、辅助模块
基于SSH框架的小型论坛项目 一.项目入门 传送门 二.框架整合 传送门 三.用户模块 传送门 四.页面显示 传送门 五.帖子模块 传送门 六.点赞模块 传送门 七.辅助模块 传送门 为避免代码冗余, ...
- Ubuntu 16.04配置SSL免费证书
主要参考地址为:https://blog.csdn.net/setoy/article/details/78441613 本篇主要以Apache这个web服务器来讲解,所以前提必须要安装好apache ...
- .item布局设置分割线
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" ...
- linux面试常见
https://www.cnblogs.com/wanghuaijun/p/7421008.html 一.填空题:1. 在Linux系统中,以 文件 方式访问设备 .2. Linux内核引导时,从文件 ...
- 6张图解释IO流
1.字节流InputStream 2.字节流OutputStream 3.字符流Reader 4.字符流Writer 5.节点流 6.处理流 总结: 节点流可以直接连接在数据源上,处理流不可以:节点流 ...
- Promise 的使用
Promise 的使用,用于异步处理 ,以及解决地狱回调的: 1. Promise 是一个构造函数,既然是构造函数,我们就可以 new Promise() 就可以得到一个 Promise 的实例 2 ...