Mean:
有一个字符串集合Ignore,还有一个文本集合TXT,在TXT中除了Ignore中的单词外其他的都是关键字,现在要你根据这些关键字来给TXT文本排序(根据关键字的字典)。
注意:一行TXT文本中含多少个关键字就需要排多少次序,如果关键字的字典序相同则按照先后顺序来排。
analyse:
这题STL用的比较多,使用STL可以很好的解决去重、排序等一序列问题,而手动实现的话就稍微繁琐一点,思路并不难。
Time complexity: O(n)
Source code:
1. STL版:
STL --- UVA 123 Searching Quickly UVA - 123 Searching Quickly
Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19296
STL --- UVA 123 Searching Quickly UVA - 123 Searching Quickly
Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19296 View Code
2.手动模拟:
STL --- UVA 123 Searching Quickly UVA - 123 Searching Quickly
Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19296
STL --- UVA 123 Searching Quickly UVA - 123 Searching Quickly
Problem's Link: http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=19296