void BuildPath(map<string, vs> &traces, vvs &pathes, vs &path, string word, string start){
    if(word == start){
        path.push_back(word);
        vs tmp = path;
        reverse(tmp.begin(), tmp.end());
        pathes.push_back(tmp);
        path.pop_back();
        return;
    }
    path.push_back(word);
    vs tmp = traces[word];
    for(int i = 0; i < tmp.size(); ++i)
        BuildPath(traces, pathes, path, tmp[i], start);
    path.pop_back();
}
示例#2
0
 void worker(vs &ret, int level, int pos, string s) {
     if(level == 3) {
         if(s.size() - pos > 3) return;
         else {
             string t = s.substr(pos, 3);
             if(t[0] == '0' && t.size() != 1) return;
             if(stoi(t) <= 255) {
                 ret.push_back(s);
             }
         }
         return;
     } 
     if(s[pos] == '0') {
         string temp = s;
         if(pos + 1 >= s.size()) return;
         temp.insert(pos + 1, 1, '.');
         worker(ret, level + 1, pos + 2, temp);
         return;
     }
     for(int i = pos; i < pos + 3; ++i) {
         if(i == pos + 2) {
             if(stoi(s.substr(pos, 3)) > 255) {
                 continue;
             }
         }
         string temp = s;
         if(i + 1 >= s.size()) return;
         temp.insert(i + 1, 1, '.');
         worker(ret, level + 1, i + 2, temp);
     }
 }
示例#3
0
文件: lab8.cpp 项目: chadenr/lab8
//SBSI has members h, wc, bsa and vtc.
vs* format_data(double data[][5])
{
    static vs output;
    
    for(int i = 0; 
            data[i][0] != 0
            || data[i][1] != 0 
            || data[i][2] != 0 
            || data[i][3] != 0
            || data[i][4] != 0; 
            i++){      
        string* tmp = new SBSI;
        tmp->h = data[i][0];
        tmp->wc = data[i][1];
        tmp->bsa = data[i][2];
        tmp->vtc = data[i][3];
        tmp->expected = data[i][4];
        output.push_back(tmp);
        //cout << "Pushed back " << output[i]->h << endl;
    }
    return &output;
/*    char* p1 = data;
    char* p2 = p1;
    int n = 0;
    int counter = 0, length = 0;
    while ( p1[0] != '\0') {
        SBSI temp;
        while ( p1[0] != ',') {
            while(!isalpha(p1[0]))
                ++p1;
            p2 = p1+1;
            while(*p2 != '\0') {
                if(*p2 == '\t')
                    length++;
                    
                    break; //Element delimiter.
            }
        }
    } 
        

*/

}
示例#4
0
void add (int si, int fi, int sj, int fj)
{
    string t;
    temp.clear();
    for (int i = si; i < fi; i++){
        for (int j = sj; j < fj; j++)
        {
            t.push_back(b[i][j]);
        }
        temp.push_back(t);
    }
    if (SET.find(temp) == SET.end())
        SET.insert(temp);
    else
    {
        fail = 1;
        return;
    }
    for (int i = )
}
int main(int argc, char const *argv[]) {
	lli n,m;
	cin >> n >> m;
	for (lli i = 0; i < n; ++i)	{
		string s;
		cin >> s;
		vec.push_back(s);
	}
	for (lli i = 0; i < m; ++i)	{
		string s;
		cin >> s;
		ib result = binary_search(0, n, s);
		string say = (result.second) ? "SIM" : "NAO";
		cout << say << " " << result.first << endl;
		comps = 0;
		if(i == 6) break;
	}

	// cout << lessThan("alg","a") << endl;
	// cout << comps << endl;
	return 0;
}
示例#6
0
	void addFunctionUse(string fun_name) {
		if (!containsElem(function_uses, fun_name)){
			function_uses.push_back(fun_name);
		}
	}