本文共 458 字,大约阅读时间需要 1 分钟。
先按长度排序,先先插入长的,在插入的时候同时进行查询。
#include #include #include #include using namespace std;typedef struct{ char str[12];}P;P p[200000];bool cmp(P p1,P p2){ if(strlen(p1.str)>strlen(p2.str)) return true; return false;}typedef struct{ int cnt; int next[11];}N;N node[200000];int top;int insert(char *str){ int len=strlen(str); int t=0; for(int i=0;i =n) printf("YES\n"); } return 0;}
转载地址:http://kkrfb.baihongyu.com/