锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲人成无码网站久久99热国产
,久久99精品久久久久久秒播,日本精品久久久中文字幕http://www.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://www.shnenglu.com/qhpeklh5959/articles/199453.html嫻呴洦姝?/dc:creator>嫻呴洦姝?/author>Mon, 15 Apr 2013 06:15:00 GMThttp://www.shnenglu.com/qhpeklh5959/articles/199453.htmlhttp://www.shnenglu.com/qhpeklh5959/comments/199453.htmlhttp://www.shnenglu.com/qhpeklh5959/articles/199453.html#Feedback0http://www.shnenglu.com/qhpeklh5959/comments/commentRss/199453.htmlhttp://www.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://www.shnenglu.com/qhpeklh5959/articles/199443.html嫻呴洦姝?/dc:creator>嫻呴洦姝?/author>Sun, 14 Apr 2013 18:39:00 GMThttp://www.shnenglu.com/qhpeklh5959/articles/199443.htmlhttp://www.shnenglu.com/qhpeklh5959/comments/199443.htmlhttp://www.shnenglu.com/qhpeklh5959/articles/199443.html#Feedback0http://www.shnenglu.com/qhpeklh5959/comments/commentRss/199443.htmlhttp://www.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://www.shnenglu.com/qhpeklh5959/articles/199440.html嫻呴洦姝?/dc:creator>嫻呴洦姝?/author>Sun, 14 Apr 2013 17:33:00 GMThttp://www.shnenglu.com/qhpeklh5959/articles/199440.htmlhttp://www.shnenglu.com/qhpeklh5959/comments/199440.htmlhttp://www.shnenglu.com/qhpeklh5959/articles/199440.html#Feedback0http://www.shnenglu.com/qhpeklh5959/comments/commentRss/199440.htmlhttp://www.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 
]]>
久久久久久精品免费免费自慰|
久久久精品人妻无码专区不卡|
久久精品国产一区二区三区
|
最新久久免费视频|
精品免费久久久久久久|
精品久久香蕉国产线看观看亚洲|
久久综合伊人77777麻豆|
久久精品国产福利国产秒|
久久99国产精品成人欧美|
久久精品www|
久久精品国产乱子伦|
国产2021久久精品|
国产精品9999久久久久|
武侠古典久久婷婷狼人伊人|
亚洲国产二区三区久久|
91精品国产综合久久精品|
亚洲精品乱码久久久久66|
久久婷婷五月综合成人D啪|
99久久人妻无码精品系列|
亚洲国产日韩欧美综合久久|
国产精品美女久久久久av爽|
久久精品国产亚洲av高清漫画|
久久精品国产亚洲av水果派|
久久五月精品中文字幕|
亚洲国产成人久久综合一|
国产精品99久久久久久人|
亚洲∧v久久久无码精品|
久久综合九色综合网站|
久久精品国产亚洲AV蜜臀色欲|
精品多毛少妇人妻AV免费久久|
成人综合伊人五月婷久久|
久久久久久亚洲Av无码精品专口|
国产成人综合久久精品红|
一本色道久久88综合日韩精品|
久久涩综合|
欧美黑人激情性久久|
久久久久亚洲精品日久生情
|
久久午夜福利电影|
亚洲国产精品狼友中文久久久|
久久久久亚洲AV综合波多野结衣|
久久精品国产亚洲av瑜伽|