ACM
醉醺醺暂住证
这个作者很懒,什么都没留下…
展开
-
bool类型不初始化是true(204)
今天写了一个类,一个bool的属性没有初始化在debug的时候会显示这个属性值为:true(204)此时,将这个属性和另一个被手动赋值为true的比较,结果竟然不相等,debug显示为:true没有204。写类的时候无参构造函数一定要初始化。...原创 2020-04-08 22:20:38 · 1266 阅读 · 0 评论 -
poj 2388----nth_element的使用
#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <string>#in...原创 2020-03-13 14:25:31 · 132 阅读 · 0 评论 -
poj 1936-串处理用for的模板
#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <string>#in...原创 2020-03-13 10:30:22 · 118 阅读 · 0 评论 -
poj 1035
这题虽然是个模拟,但是很容易超时,几种情况合并之后可以简化问题。考虑到删除,增加,替换一个字符的情况,可以灵活使用指针i,用两个for循环遍历串,最后检查指针i的位置即可#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <cti...原创 2020-03-11 22:31:27 · 141 阅读 · 0 评论 -
memset的使用注意----memset范围
今天做算法题,dijkstra求最短路的,使用的算法竞赛模板里将inf 定义为#define inf (1<<28)在给图初始化时,用了memsetmemset(a, inf, sizeof(a));给我的二维数组int a[maxn][maxn];初始化结果一直不对,debug之后,发现memset没有起作用,查了一些博客,得出的结论是:memset只接受0x0...原创 2020-02-27 22:53:04 · 370 阅读 · 0 评论