
复旦机试题
文章平均质量分 65
渊渊大魔王
这个作者很懒,什么都没留下…
展开
-
二叉树遍历
2014年第三题 根据题目要求,先建树,建好树之后进行遍历即可 #include using namespace std; struct Node { int val; Node *lchild; Node *rchild; }; Node Tree[10000]; int local; void preOrder(Node* T) { cou原创 2017-03-22 16:54:14 · 259 阅读 · 0 评论 -
复旦机试之汉诺塔问题
经典的汉诺塔问题,我们在此基础上再在最后的输出结果中输出移动的是哪一片铜片。 #include using namespace std; long long x; long long y; void move(char a,int n,char c) { x++; if (x > y-100) { cout " << c << ' ' << n <原创 2017-03-23 12:01:23 · 665 阅读 · 0 评论 -
复旦机考之字符串匹配
使用string.find()可以暴力破解 #include #include using namespace std; struct Node { string m; string p; }; int main() { int n; cin >> n; Node str[100]; for (int i = 0;i < n;i++)原创 2017-03-23 13:47:09 · 464 阅读 · 0 评论