摘要: 做得比较乱,修改多次后终于AC #include <string> #include <iostream> #include <algorithm> using namespace std; bool cmp(string a,string b){ if(a == b) return false; 阅读全文
posted @ 2016-03-08 10:54 aldorado 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 两个set维护在stack中和不在stack中的元素,priority_queue维护在stack中的最大元素 AC代码 #include <set> #include <iostream> #include <queue> #include <cstdio> #include <vector> u 阅读全文
posted @ 2016-03-03 21:12 aldorado 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 从所有一位数包含的1开始向上递推所有k位数包含的1,递推式: ak = ak-1 * 10 + pow(10,k-1); AC代码: #include <vector> #include <cstdio> using namespace std; int main(){ int n; vector< 阅读全文
posted @ 2016-03-03 20:26 aldorado 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 以每个字符为中心,分两种情况向两边扩展。 manacher算法参见http://www.cnblogs.com/houkai/p/3371807.html AC代码: #include <string> #include <cstdio> #include <iostream> using name 阅读全文
posted @ 2016-03-02 16:24 aldorado 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 最后一点用string 和cin会超时 将学生名字转换成int用scanf就可以了 AC代码: #include <vector> #include <string> #include <map> #include <set> #include <cstdio> #include <iostream 阅读全文
posted @ 2016-03-02 16:03 aldorado 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 注意:最小数为0时,要输出“0” AC代码 #include <string> #include <vector> #include <algorithm> #include <iostream> using namespace std; bool cmp(const string& a,const 阅读全文
posted @ 2016-03-02 12:42 aldorado 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 简单并查集 AC代码 #include <map> #include <string> #include <iostream> #include <cstdio> #include <vector> using namespace std; string find(map<string,string 阅读全文
posted @ 2016-03-01 23:40 aldorado 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 贪心算法 注意两点: 1、sum用double类型 2、第二个测试点是起点没有加油站的情况 AC代码 1 #include <vector> 2 #include <cstdio> 3 #include <algorithm> 4 #include <map> 5 using namespace s 阅读全文
posted @ 2016-03-01 22:32 aldorado 阅读(160) 评论(0) 推荐(0) 编辑