摘要:
排序二叉树View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 105struct Node{ Node *left, *right; char letter;}tree[maxn];char st[maxn];int node_cnt;void insert(Node * &proot, char ch){ if (proot == NULL) { proot = 阅读全文
posted @ 2013-03-26 15:46
undefined2024
阅读(462)
评论(0)
推荐(0)
摘要:
dfs+排序View Code //zoj1684//注意字典序排序,是按照逐个单词比较出来的,每个句子的第x个单词只和其他句子的第x个单词进行比较。先比第一个单词再比第二个单词//例如: 句子"i am"的字典序就在句子"ia m"的前面//还有根据g++编译器,string是不能进行memset的,否则会出错。#include <iostream>#include <string>using namespace std;const int maxn = 105, maxl = 105, maxa = 105;struct wo 阅读全文
posted @ 2013-03-26 15:19
undefined2024
阅读(244)
评论(0)
推荐(0)
摘要:
dpView Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 105#define inf 0x3f3f3f3fint n;int f[maxn];int g[maxn][maxn];int main(){ //freopen("t.txt", "r", stdin); scanf("%d", &n); for 阅读全文
posted @ 2013-03-26 14:24
undefined2024
阅读(348)
评论(0)
推荐(0)
摘要:
dp注意要多dp出一段,因为有时候付钱需要超过100元再找钱。求和函数accumulate需要包含头文件numeric,使用方法为sum = accumulate(f, f + n, 0);求最大值函数max_element返回最大值指针,需要包含头文件algorithm,使用方法为max_value=*max_element(f, f+n);View Code #include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <algorith 阅读全文
posted @ 2013-03-26 13:49
undefined2024
阅读(218)
评论(0)
推荐(0)

浙公网安备 33010602011771号