摘要: 题目链接https://ac.nowcoder.com/acm/contest/392#question A-华华听月月唱歌 区间覆盖问题(在点上的覆盖) 1、先对start从小到大排序 2、设s为当前已经覆盖的最右端,对所有包含s点的区域,取最右端的点+1赋予s ac代码: #include<io 阅读全文
posted @ 2019-03-09 19:37 looeyWei 阅读(227) 评论(0) 推荐(0) 编辑
摘要: map 看个例子: #include<iostream> #include<map> #include<string> using namespace std; int n; string s; int main() { while (cin >> n, n){ map<string, int>a; 阅读全文
posted @ 2019-03-09 19:00 looeyWei 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1004 map的用法,第一次看见map还能这么用 #include<iostream> #include<map> #include<string> using namespace std; int n; 阅读全文
posted @ 2019-03-09 18:57 looeyWei 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 高精度加法 #include<iostream> #include<string> #include<cstring> #include<algorithm> using namespace std; const int maxn = 1010; int an[maxn], bn[maxn]; st 阅读全文
posted @ 2019-03-09 18:30 looeyWei 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 算法步骤 1、用 cur 维护当前和 (初始化为0),用 res 保存最终结果 (初始化为 -inf),用 temp 维护开始的位置 2、遍历 a 数组,cur+=a[i] ,如果 cur < 0,则 cur=0 ,temp=i+1从新开始 3、如果 cur>res,更新res=cur,l=temp 阅读全文
posted @ 2019-03-09 18:28 looeyWei 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1003 #include<iostream> #include<algorithm> using namespace std; const int maxn = 100010; const int inf 阅读全文
posted @ 2019-03-09 18:20 looeyWei 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=1002 高精度模板题 #include<iostream> #include<string> #include<cstring> #include<algorithm> using namespace st 阅读全文
posted @ 2019-03-09 17:58 looeyWei 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 有序单链表的合并 不需要另外开辟存储空间 typedef struct node{ int data; struct node *next; }*PNode,Node,*List; void Message(List &LA,List &LB,List &LC){ PNode pa = LA->ne 阅读全文
posted @ 2019-03-09 14:47 looeyWei 阅读(66) 评论(0) 推荐(0) 编辑
摘要: 基本数据类型(常用) 整数类型:Integer 实数类型:Double 字符类型:Char 字符串类型:String 布尔类型:Boolean 数据类型转换 inttostr(x) 将字符串x转换成int,前提是x为数值型字符串 相应的还有:strtoint(x)、floattostr(x)、str 阅读全文
posted @ 2019-03-09 08:59 looeyWei 阅读(681) 评论(0) 推荐(0) 编辑