csdn:https://blog.csdn.net/su_cicada/article/details/86710107 例题5-4 反片语(Ananagrams,Uva 156) 输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排,得到输入文 本中的另外一个单词. 在判断是否满足条件时,字母不分大小写,但在输出时应保留输入中 的大小写,按字典序进行排列(所有大写字母在所有小写字母的前面). Sample Input ladder came tape soon leader ac…
题目链接:https://vjudge.net/contest/211547#problem/D 题目大意: 输入一些单词,找出所有满足以下条件的单词:该单词不能通过字母重排,得到输入文本中的另外一些单词.在判断是否满足条件时,字母不区分大小写.但在输出时应保留输入时的大小写,按字典序进行排列(所有大写字母在所有小写字母的前面) 样例输入: ladder came tape soon leader acme RIDE lone Dreis peat ScAlE orb eye Rides dea…
 Ananagrams  Most crossword puzzle fans are used to anagrams--groups of words with the same letters in different orders--for example OPTS, SPOT, STOP, POTS and POST. Some words however do not have this attribute, no matter how you rearrange their let…
题目链接 题意:输入一些单词,找出所有满足如下条件的单词:该单词不能通过字母重排,得到输入文本中的另外一个单词.在判断是否满足条件时,字母不分大小写,但在输出时应保留输入中的大小写,按字典序进行排列(所有大写字母在所有小写字母的前面). 刘汝佳算法竞赛入门经典(第二版)P113 #include <cstdio> #include <map> #include <set> #include <string> #include <vector> #…
题意:给出一些单词,在这些单词里面找出不能通过字母重排得到的单词(判断的时候不用管大小写),然后按照字典序输出. 学习的紫书的map= = 将每一个单词标准化 先都转化为小写,再排序(即满足了题目中说的不能通过字母重排这个条件) 然后记录出现次数,将出现次数为1的储存再输出 话说这一题的标准化要好好学学= =(字母重排用排序来做= =) #include<iostream> #include<cstdio> #include<cstring> #include<v…
原题链接: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=98&page=show_problem&problem=92 整体思路如下:先建立一个 multimap<排序的词,未排序的词> 来处理输入,完毕后将只有一个值的键放入一个set中,最后遍历set输出即可.切忌不要误用成 map, 因为 multimap 允许重复元素,map 不允许有重复. 更…
Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, regional contests like Xi'an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ contests like Rujia Liu's Presents 1 and 2), he occasionally sets easy probl…
11991 - Easy Problem from Rujia Liu? Though Rujia Liu usually sets hard problems for contests (for example, regional contests likeXi’an 2006, Beijing 2007 and Wuhan 2009, or UVa OJ contests like Rujia Liu’s Presents 1and 2), he occasionally sets easy…
map,vector 等容器内容的循环删除问题(C++) map,vector等容器的循环删除不能用普通的方法删除: for(auto p=list.begin();p!=list.end();p++) list.erase(p); 类似的方式,会出错的,不信你调试试试 :) 这里使用了一个` iterator` 的一个自增/自减 ,来巧妙的实现了, 删除当前的`iterator,` 但是有给当前的`iterator`赋值为其下一个的操作,不至于删除后,当前的 `iterator` 就失效了!…
传送门 本来出题人出出来想考数据结构的. 但是我们拥有map+vector/set这样优秀的STL,因此直接用map离散化,vector存下标在里面二分找答案就行了. 代码: #include<bits/stdc++.h> #define N 100005 using namespace std; inline int read(){ int ans=0; char ch=getchar(); while(!isdigit(ch))ch=getchar(); while(isdigit(ch)…