2013年6月19日
摘要: 题目链接。分析:模拟。果然模拟什么的最讨厌了。用e1,e2分别记录队列1,队列2的结束时间。每个结点的s记录开始时间,e一开是记录逗留时间,进队列的时候,改成离开的时间。时刻记录总时间就可以了。#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <queue>#include <vector>using namespace std;const int maxn = 1000 + 10;struct node { 阅读全文
posted @ 2013-06-19 22:26 Still_Raining 阅读(798) 评论(0) 推荐(1)
摘要: 题目链接。分析:转换成表达式树,然后先序、中序、后序遍历。AC代码如下:#include <stdio.h>#include <string.h>#define maxn 1000int lch[maxn], rch[maxn], nc = 0;char op[maxn];int build_tree(char *s, int x, int y) { int i, c1 = -1, c2 = -1, p = 0; int u; if(y-x == 1) { u = ++nc; lch[u] = rch[u] = 0; op[u] = s[x]; ... 阅读全文
posted @ 2013-06-19 19:06 Still_Raining 阅读(442) 评论(0) 推荐(0)