锘??xml version="1.0" encoding="utf-8" standalone="yes"?>四虎国产精品免费久久久,无码人妻久久一区二区三区免费,久久天天躁狠狠躁夜夜不卡http://m.shnenglu.com/qhpeklh5959/category/20476.html鏌崇誕鍥犻璧?/description>zh-cnMon, 22 Apr 2013 20:07:04 GMTMon, 22 Apr 2013 20:07:04 GMT60- POJ3630 Phone Listhttp://m.shnenglu.com/qhpeklh5959/articles/199453.html嫻呴洦姝?/dc:creator>嫻呴洦姝?/author>Mon, 15 Apr 2013 06:15:00 GMThttp://m.shnenglu.com/qhpeklh5959/articles/199453.htmlhttp://m.shnenglu.com/qhpeklh5959/comments/199453.htmlhttp://m.shnenglu.com/qhpeklh5959/articles/199453.html#Feedback0http://m.shnenglu.com/qhpeklh5959/comments/commentRss/199453.htmlhttp://m.shnenglu.com/qhpeklh5959/services/trackbacks/199453.html棰樼洰閾炬帴錛?a style="color: #6a3906; text-decoration: none;">http://poj.org/problem?id=3630
榪欓亾棰樺拰1056鏄竴鏍風殑錛岄兘鏄垽鏂竴涓崟璇嶆槸鍚︽槸鍙︿竴涓崟璇嶇殑鍓嶇紑

view code
1 #include <cstdio>
2 #include <cstring>
3 struct trie{
4 int ch[100100][12];
5 int val[100100];
6 int sz;
7 void reset(){
8 memset(ch[0], 0, sizeof(ch[0]));
9 memset(val, 0, sizeof(val));
10 sz = 1;
11 }
12 int idx(char c){
13 return c - '0';
14 }
15 void insert(char *s, int v){
16 int u = 0, n = strlen(s);
17 for (int i = 0; i < n; i++){
18 int c = idx(s[i]);
19 if (!ch[u][c]){
20 memset(ch[sz], 0, sizeof(ch[sz]));
21 ch[u][c] = sz;
22 val[sz] = 0;
23 sz += 1;
24 }
25 u = ch[u][c];
26 }
27 val[u] = v;
28 }
29 bool query(char *s, int v){
30 int u = 0, n = strlen(s), cnt = 0;
31 for (int i = 0; i < n; i++){
32 int c = idx(s[i]);
33 u = ch[u][c];
34 if (val[u] == v) cnt += 1;
35 }
36 if (cnt > 1) return 0;
37 return 1;
38 }
39 }t;
40 char s[10010][12];
41 int main(){
42 int p, n;
43 scanf("%d", &p);
44 while (p--){
45 t.reset();
46 scanf("%d", &n);
47 for (int i = 0; i < n; i++){
48 scanf("%s", s[i]);
49 t.insert(s[i], -1);
50 }
51 bool f = 1;
52 for (int i = 0; i < n; i++)
53 if (!t.query(s[i], -1)){
54 f = 0; break;
55 }
56 if (!f) printf("NO\n");
57 else printf("YES\n");
58 }
59 return 0;
60 }
61 
]]>- POJ2001 Shortest Prefixeshttp://m.shnenglu.com/qhpeklh5959/articles/199443.html嫻呴洦姝?/dc:creator>嫻呴洦姝?/author>Sun, 14 Apr 2013 18:39:00 GMThttp://m.shnenglu.com/qhpeklh5959/articles/199443.htmlhttp://m.shnenglu.com/qhpeklh5959/comments/199443.htmlhttp://m.shnenglu.com/qhpeklh5959/articles/199443.html#Feedback0http://m.shnenglu.com/qhpeklh5959/comments/commentRss/199443.htmlhttp://m.shnenglu.com/qhpeklh5959/services/trackbacks/199443.html棰樼洰閾炬帴錛?a style="color: #220000; text-decoration: none;">http://poj.org/problem?id=2001
鍙︿竴縐嶅瓧鍏告爲鐨勫啓娉?#8230;…

view code
1 #include <iostream>
2 #include <cstdio>
3 #include <cstring>
4 using namespace std;
5 struct trie{
6 int num;
7 int next[30];
8 int init(){
9 num = 1;
10 memset(next, -1, sizeof(next));
11 return 0;
12 }
13 }tree[100100];
14 int sz = 1;
15 const int rt = 0;
16 int idx(char c){
17 return c - 'a';
18 }
19 void insert(string s){
20 int p = rt, n = s.size();
21 for (int i = 0; i < n; i++){
22 int v = idx(s[i]);
23 if (tree[p].next[v] == -1){
24 tree[p].next[v] = sz;
25 tree[sz].init();
26 sz += 1;
27 }
28 else tree[tree[p].next[v]].num += 1;
29 p = tree[p].next[v];
30 }
31 }
32 void print(string s){
33 int p = rt, n = s.size();
34 for (int i = 0; i < n; i++){
35 int v = idx(s[i]);
36 putchar(s[i]);
37 if (tree[tree[p].next[v]].num == 1) return;
38 p = tree[p].next[v];
39 }
40 }
41 void init(){
42 sz = 1;
43 tree[0].init();
44 }
45 string s[2010];
46 int main(){
47 init();
48 int n = 0;
49 while(cin >> s[n]) insert(s[n++]);
50 for (int i = 0; i < n; i++){
51 cout << s[i] << " ";
52 print(s[i]);
53 printf("\n");
54 }
55 return 0;
56 }
57 
view code
]]> - POJ1056 IMMEDIATE DECODABILITYhttp://m.shnenglu.com/qhpeklh5959/articles/199440.html嫻呴洦姝?/dc:creator>嫻呴洦姝?/author>Sun, 14 Apr 2013 17:33:00 GMThttp://m.shnenglu.com/qhpeklh5959/articles/199440.htmlhttp://m.shnenglu.com/qhpeklh5959/comments/199440.htmlhttp://m.shnenglu.com/qhpeklh5959/articles/199440.html#Feedback0http://m.shnenglu.com/qhpeklh5959/comments/commentRss/199440.htmlhttp://m.shnenglu.com/qhpeklh5959/services/trackbacks/199440.html棰樼洰閾炬帴錛?a style="color: #6a3906; text-decoration: none;">http://poj.org/problem?id=1056
榪欓亾棰樼敤瀛楀吀鏍戝彲鎺ワ紝鍏蜂綋鎬濊礬灝辨槸姣忛亣鍒頒竴涓崟璇嶉兘鎶婂畠鎻掑叆鍒板瓧鍏告爲涔嬩腑錛岀劧鍚庡鏋滈亣鍒頒簡9錛屽氨鏌ヨ姣忎釜鍗曡瘝鐨勮瘝灝炬爣璁扮殑鏁伴噺錛屽鏋滆瘝灝炬爣璁扮殑鏁伴噺澶氫簬1錛屽垯璇佹槑鍙﹀涓涓崟璇嶆槸榪欎釜鍗曡瘝鐨勫墠緙錛岃緭鍑哄け璐ワ紝鍚﹀垯鐨勮瘽杈撳嚭鎴愬姛銆?br />

view code
1 #include <iostream>
2 #include <cstdio>
3 #include <cstring>
4 #include <vector>
5 using namespace std;
6 struct trie{
7 int ch[110][2];
8 int val[100];
9 int sz;
10 void reset(){
11 sz = 1; memset(ch[0], 0, sizeof(ch[0]));
12 memset(val, 0, sizeof(val));
13 }
14 int idx(char c){
15 return c - '0';
16 }
17 void insert(string s, int v){
18 int u = 0, n = s.size();
19 for (int i = 0; i < n; i++){
20 int c = idx(s[i]);
21 if (!ch[u][c]){
22 memset(ch[sz], 0, sizeof(ch[sz]));
23 val[sz] = 0;
24 ch[u][c] = sz++;
25 }
26 u = ch[u][c];
27 }
28 val[u] = v;
29 }
30 bool query(string s, int v){
31 int u = 0, n = s.size(), cnt = 0;
32 for (int i = 0; i < n; i++){
33 int c = idx(s[i]);
34 u = ch[u][c];
35 if (val[u] == v) cnt += 1;
36 }
37 if (cnt > 1) return 0;
38 return 1;
39 }
40 };
41 trie t;
42 string s;
43 vector<string> v;
44 int main(){
45 t.reset();
46 int p = 1;
47 while (cin >> s){
48 if (s.compare("9") == 0){
49 printf("Set %d is ", p++);
50 bool f = 1;
51 for (int i = 0; i < v.size(); i++)
52 if (!t.query(v[i], -1)){
53 f = 0; break;
54 }
55 if (!f) printf("not ");
56 printf("immediately decodable\n");
57 t.reset();
58 v.clear();
59 }
60 else{
61 v.push_back(s);
62 t.insert(s, -1);
63 }
64 }
65 return 0;
66 }
67 
]]>
精品免费久久久久国产一区
|
韩国免费A级毛片久久|
人妻少妇久久中文字幕一区二区
|
久久精品亚洲乱码伦伦中文|
久久精品亚洲福利|
欧美黑人激情性久久|
久久精品亚洲福利|
精品无码久久久久久午夜|
国产巨作麻豆欧美亚洲综合久久|
少妇熟女久久综合网色欲|
国产精品久久成人影院|
18禁黄久久久AAA片|
国产香蕉97碰碰久久人人|
久久精品国产亚洲av水果派|
久久婷婷五月综合色99啪ak
|
久久人人爽人人爽AV片|
国产亚洲欧美精品久久久|
午夜精品久久久久久影视riav|
精品久久777|
久久久久久亚洲Av无码精品专口|
少妇久久久久久被弄到高潮|
久久精品一区二区三区不卡|
久久人人爽人人爽人人片av麻烦|
久久AⅤ人妻少妇嫩草影院|
久久九九青青国产精品|
69久久夜色精品国产69|
亚洲午夜久久久久久久久久|
久久久久久午夜精品|
亚洲精品美女久久久久99小说|
日本福利片国产午夜久久|
久久精品水蜜桃av综合天堂|
热re99久久精品国99热|
日韩人妻无码精品久久免费一|
中文字幕无码av激情不卡久久|
久久亚洲AV无码西西人体|
久久精品国产亚洲Aⅴ蜜臀色欲|
99热成人精品免费久久|
91久久精品国产91性色也|
72种姿势欧美久久久久大黄蕉|
久久亚洲国产午夜精品理论片|
亚洲国产精品久久久久网站|