摘要:PE了一早上——就是因为行末空格的问题想过用链表在遍历过程中存储节点,然后打印;想过用静态变量保存;最后,回到了指针,传递计数器的地址。View Code //1005 BST 建树、遍历# include <stdio.h># include <stdlib.h>typedef struct Tnode{ int key; struct Tnode *left; struct Tnode *right;}node;node *BST_insert(node *root, node *p);void preorder(node *x, int *p);void inor
阅读全文
摘要:类型的差别造成奇怪的运行结果——输出错误、无法继续输入等新增:找出下面代码的错误:# include <stdio.h># include <string.h> # define MAXN 10005 int main(){ short m, n, i, ans, tmp, t[MAXN]; while (~scanf("%d%d", &n, &m)) { memset(t, 0, sizeof(t)); for (i = 1; i <= m; ++i) { scanf("%d", &tmp); ..
阅读全文
摘要:TLE了 不知道怎么办 还是用枚举?// poj 2965 bfs & STL queue# include <iostream># include <cstring># include <queue>using namespace std;const unsigned short flip[] = {0x111f, 0x222f, 0x444f, 0x888f, 0x11f1, 0x22f2, 0x44f4, 0x88f8, 0x1f11, 0x2f22,...
阅读全文