上一页 1 ··· 53 54 55 56 57 58 59 60 61 ··· 99 下一页

2011年7月20日

字典树 统计难题

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX 26struct Trie { Trie *next[MAX]; int v;};Trie *root;void creattrie(char *str){ Trie *p, *q; int t, len, i, j; p = root; len = strlen(str); for (i = 0; i < len; i++) { t = str[i] - 'a'; if(p->next[t] = 阅读全文

posted @ 2011-07-20 11:33 more think, more gains 阅读(158) 评论(0) 推荐(0)

Dating with girls

摘要: 用二分查找。。#include <stdio.h>#include <stdlib.h>#include <algorithm>#include <string.h>#include <istream>using namespace std;int A[100010],visit[100010];//二分 int find(int l, int r, int v){ int mid; while (l <= r) { //printf("****"); mid = (l + r) / 2; if( A[mid 阅读全文

posted @ 2011-07-20 11:30 more think, more gains 阅读(228) 评论(0) 推荐(0)

排名 模拟题

摘要: #include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;int N, M, G;int g[20];struct node { int num[20]; char name[50]; int n; int sum;}T[1010];/*int cmp(node a, node b){ if (a.sum != b.sum ) return a.sum - b.sum; return strcmp(a.name,b 阅读全文

posted @ 2011-07-20 11:18 more think, more gains 阅读(136) 评论(0) 推荐(0)

Crixalis's Equipment hdu 3177

摘要: 这题我用的是逆向思维,从洞里把它拿出来,不用考虑先拿什么。。只要满足条件就拿出来。暴力搜索,最后竟然0ms。看了下网上的代码用的是差值排序。。。用时还要15ms#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;int V[1010], L[1010];struct node{ int v, l;}T[1010];int main( ){ int P, i, M, N, flag, v, m, flag1; scanf("%d",& 阅读全文

posted @ 2011-07-20 11:15 more think, more gains 阅读(176) 评论(0) 推荐(0)

排序

摘要: 字符串处理,刚开始又出错了。。以后还是慎用for ,用while好点。。 1 #include <stdio.h> 2 #include <string.h> 3 #include <stdlib.h> 4 #include <algorithm> 5 6 using namespace std; 7 char ch[1010]; 8 char str[10]; 9 int dp[1010];10 11 int main( )12 {13 int i, j, t, len, k, flag;14 while(scanf("%s" 阅读全文

posted @ 2011-07-20 11:12 more think, more gains 阅读(92) 评论(0) 推荐(0)

上一页 1 ··· 53 54 55 56 57 58 59 60 61 ··· 99 下一页

导航