随笔分类 -  ACM-技巧

摘要:HDU2089,属于数位dp入门系列。 多做做应该就会了。 1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<algorithm> 5 #include<queue> 6 #include<cstring> 7 阅读全文
posted @ 2021-02-25 23:53 Lovaer 阅读(82) 评论(1) 推荐(1) 编辑
摘要:reverse函数: #define dbg(args...) cout<<#args<<" : "<<args<<endl; char s[5]="sacd"; dbg(s); reverse(s,s+4); dbg(s); string ss="abcde"; reverse(ss.begin( 阅读全文
posted @ 2021-01-30 22:09 Lovaer 阅读(112) 评论(0) 推荐(1) 编辑
摘要:关于multiset,有如下结论: 1 multiset<int> s; 2 s.insert(3); 3 s.insert(3); 4 cout<<s.count(3);//结果输出2 5 s.erase(3); 6 cout<<s.count(3);//结果输出0 因此multiset模拟时应注 阅读全文
posted @ 2020-01-19 23:53 Lovaer 阅读(127) 评论(0) 推荐(1) 编辑
摘要:下面是map,set,unordered_map,unordered_set的性能分析。 map,内部红黑树,插入复杂度O(logn),查找复杂度O(logn),用键值对应value; set,内部红黑树,插入复杂度O(logn),查找复杂度O(logn),只有value不存在键值; unorder 阅读全文
posted @ 2019-10-02 02:15 Lovaer 阅读(603) 评论(0) 推荐(2) 编辑
摘要:map<type> mp1; 插入复杂度O(logn),查找复杂度O(logn),内部是红黑树 unordered_map mp2; 插入复杂度O(1),查找复杂度O(1),内部是哈希表 阅读全文
posted @ 2019-09-08 16:32 Lovaer 阅读(251) 评论(0) 推荐(1) 编辑
摘要:数字转字符串: itoa(int1, char*, int2); //将int1以int2进制存储在char*数组里 ltoa(long, char*, int); //将long以int进制存储在char*数组里 ultoa(unsigned long, char*, int); //将unsig 阅读全文
posted @ 2019-08-23 11:30 Lovaer 阅读(9261) 评论(0) 推荐(2) 编辑
摘要:首先来说C; 开启重定向语句: freopen("input.txt", "r", stdin); //将之后的读入都从input.txt中读入 freopen("output.txt", "w", stdout); //将之后的写入都写到output.txt中 关闭重定向语句: 关闭读入:freo 阅读全文
posted @ 2019-08-22 11:38 Lovaer 阅读(375) 评论(0) 推荐(1) 编辑

点击右上角即可分享
微信分享提示