问题汇总
错误信息:
binary ‘>>’ : no operator found which takes a right-hand operand of type ‘std::string’ (or there is no acceptable conversion)
string类没有重载“<<”操作符,用cout不能直接输出string类型
解决方法:
#include<string>
警告信息:
warning:deprecated conversion from string constant to ‘char *’
char *:意为给我个字符串,我要修改它。但理论上,传给函数的字面常量无法被修改。
解决方法:
参数类型改为 const char *
意为:给我个字符串,我只要读取它。
错误信息:
Sigmention Fault
解决方法:
删代码找问题
技巧:
- 用unsigned long long 存储h,溢出 与 mod 264等价
- 上下左右四个方向拓展,用向量表示:
↑ (-1,0)
→(0,1)
↓ (1,0)
←(0,-1)
即dx[]={-1,0,1,0},dy[]={0,1,0,-1};
- 单独#include每个头文件,速度会比#include<bits/stdc++.h> 万能头快得多
- 使用string类时
str += s;
比str=str+s;
快