int main() { char str[100]; while(scanf("%s",str)) { int len=strlen(str); int ar[100]; for( int i=0; i<len; i++ ) ar[i]=i; VS v; string st; sort(ar,ar+len); do { for( int i=0; i<len; i++ ) st+=str[ar[i]]; v.PB(st); st.clear(); } while(next_permutation(ar,ar+len)); for( int i=0; i<v.size()/len; i++ ) { for( int j=i; j<v.size(); j+=7 ) cout<<v[j]<<endl; } v.clear(); printf("\n"); } return 0; }
int main() { int m, n; int i, j, k; int max_subfile, max_file; string s, x; //freopen("f:\\in.txt", "r", stdin); while (cin >> s) { flist.clear(); for (i=3; s[i]; ++i) { if (s[i] == '\\') flist.push_back(s.substr(0, i)); } n = flist.size(); for (i=0; i!=n; ++i) { if (fc.find(flist[i]) == fc.end()) { for (j=0; j!=i; ++j) { if (subfile.find(flist[j]) == subfile.end()) subfile.insert(make_pair(flist[j], 1)); else ++subfile[flist[j]]; } fc.insert(flist[i]); } if (file.find(flist[i]) == file.end()) file.insert(make_pair(flist[i], 1)); else ++file[flist[i]]; } } max_subfile = 0, max_file = 0; for (MSII it=subfile.begin(); it!=subfile.end(); ++it) max_subfile = max(max_subfile, it->second); for (MSII it=file.begin(); it!=file.end(); ++it) max_file = max(max_file, it->second); printf("%d %d\n", max_subfile, max_file); return 0; }
int main(){ int i, n; char buff[MAXL]; VS code; while(scanf("%d", &n) == 1){ code.clear(); for(i = 0; i < n; i++){ scanf(" %s", buff); code.push_back(buff); } printf("[%s]\n", UDFind(code).c_str()); } return 0; }
void generateTestData(const int scenario, const int subset) { size_t subset_total = dataSamples.size() / subsetsNum; int train_start_index = subset * (int)subset_total; int test_start_index = train_start_index + subset_total * 0.66; int end_index = train_start_index + (int)subset_total; if (end_index > dataSamples.size()) { end_index = (int)dataSamples.size(); } // // prepare train data // DTrain.clear(); double mean = 0; int countIq = 0; for (int i = train_start_index; i < test_start_index; i++) { VS rows = dataSamples[i]; for (int r = 0; r < rows.size(); r++) { string line = rows[r]; VS values = splt(line); double iq = atof(values[iqCol].c_str()); if (scenario > 0) { DTrain.push_back(line); } else if (iq > 0) { // add only line with IQ set for 1 scenario DTrain.push_back(line); } if (iq > 0) { mean += iq; countIq++; } } } // filterDataSet(DTrain, scenario, true); // // prepare test data // DTest.clear(); groundTruth.clear(); for (int i = test_start_index; i < end_index; i++) { VS rows = dataSamples[i]; for (int r = 0; r < rows.size(); r++) { string line = rows[r]; VS values = splt(line); double iq = atof(values[iqCol].c_str()); if (iq > 0) { groundTruth.push_back(iq); // add only line with IQ set for 1 scenario DTest.push_back(line); } else if (scenario > 0) { DTest.push_back(line); } } } // filterDataSet(DTest, scenario, false); // // calculate sse0 // mean /= countIq; sse0 = 0; for (const double &iq : groundTruth) { double e = mean - iq; sse0 += e * e; } }