Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <queue>
- #include <stack>
- #include <map>
- #include <algorithm>
- #include <numeric>
- #include <functional>
- #include <set>
- #include <sstream>
- #include <cstdio>
- #include <cstdlib>
- #include <cstring>
- #include <cmath>
- #include <cctype>
- #include <climits>
- #include <fstream>
- #include <time.h>
- #define FOR(i,a,b) for(int i=(a);i<(b);++i)
- #define FORE(i,a,b) for(int i=(a);i<=(b);++i)
- #define REP(i,n) FOR(i,0,n)
- #define REPE(i,n) FORE(i,0,n)
- #define FOE(i,a) for(auto i : a)
- #define ALL(c) (c).begin(), (c).end()
- #define DUMP(x) cerr << #x << " = " << (x) << endl;
- #define SUM(x) std::accumulate(ALL(x), 0L)
- using namespace std;
- struct FoxAndWord {
- vector<string> words;
- int howManyPairs(vector<string> _words) {
- words = _words;
- int ans = 0;
- REP(i, words.size()) {
- FOR(j, i + 1, words.size()) {
- if (words[i].size() != words[j].size()) { continue; }
- string tt = words[j] + words[j];
- if (tt.find(words[i]) != string::npos) {
- ans++;
- }
- }
- }
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement