调试技巧 通过一些宏定义,可以让调试代码变得更简洁。 #define print(a) cout << #a << ": "; for(int i = 1; i <= n; i++) { cout << a[i] << ' '; } cout << endl; 等待函数可以防止死循环和死递归产生的刷屏: #include<unistd.h> usleep(unsigned int); // 单位:微秒