理工Oj 1341 Who will be punished
2016-06-30 08:52
281 查看
Who will be punished
Time Limit: 1000 MS Memory Limit: 32767 K
Total Submit: 559(93 users) Total Accepted: 208(80 users) Rating: Special Judge: No
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
位运算的巧妙应用,6^7^8^7^8=6
那么这个规律可以用在子串上,所得的结果就是其 ASCLL 码值 进行异或。
Time Limit: 1000 MS Memory Limit: 32767 K
Total Submit: 559(93 users) Total Accepted: 208(80 users) Rating: Special Judge: No
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
位运算的巧妙应用,6^7^8^7^8=6
那么这个规律可以用在子串上,所得的结果就是其 ASCLL 码值 进行异或。
#include <stdio.h> #include <algorithm> #include <iostream> #include <string.h> #include <string> using namespace std; int main() { int n,id; while(~scanf("%d",&n)) { char s[31]; char ans[31]; scanf("%s",ans); for(int i=1;i<2*n-1;i++) { scanf("%s",s); for(int j=0;j<strlen(s);j++) { ans[j]^=s[j]; } } static int times=1; printf("Scenario #%d\n",times++); printf("%s",ans); printf("\n\n"); } return 0; }
相关文章推荐
- 使用位运算实现网页中的过滤、筛选功能实例
- C#枚举中的位运算权限分配浅谈
- 快速学习JavaScript的6个思维技巧
- shell 基本计算、逻辑运算、位运算详解
- Java位运算和逻辑运算的区别实例
- 优秀程序员必须知道的20个位运算技巧
- JavaScript使用位运算符判断奇数和偶数的方法
- java位运算加密示例
- c语言中用位运算实现加法技巧介绍
- 基础的十进制按位运算总结与在Python中的计算示例
- 暗时间读书笔记
- 跳不出思维的惯性模式,何谈颠覆?【读历史知创业】
- 你有没有意识到,计算时代已经悄然降临
- 穷人的饥饿思维
- 思维定势
- 关联性思维和给客户展示功能
- Java 位运算(移位、位与、或、异或、非)
- 经典的售前思维题目,一个很经典的故事
- 变革思维