Created
September 12, 2018 00:15
-
-
Save cbdavide/939876fc1a12bf5ab3ac9953efa4c4ad to your computer and use it in GitHub Desktop.
UVa - 13257 - License Plates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
template <class T> int size(const T &x) {return x.size();} | |
template <class T> T mod(T a, T b) { return (b + (a % b)) % b;} | |
#define F first | |
#define S second | |
#define PB push_back | |
#define endl '\n' | |
#define rep(i, a, b) for(__typeof(a) i=a; i<(b); i++) | |
#define iter(it, c) for(__typeof((c).begin()) it=(c).begin(); \ | |
it != (c).end(); it++) | |
typedef long long ll; | |
typedef unsigned long long ull; | |
typedef pair<int, int> ii; | |
typedef vector<int> vi; | |
typedef vector<ii> vii; | |
typedef vector<vii> vvii; | |
typedef vector<vi> vvi; | |
typedef set<int> si; | |
const int INF = ~(1 << 31); | |
const double EPS = 1e-9; | |
const double PI = acos(-1); | |
int main() { | |
ios_base::sync_with_stdio(false); | |
cin.tie(NULL); | |
string s; | |
int n; cin >> n; | |
while(n--) { | |
cin >> s; | |
int res=0; | |
set<char> T(s.begin(), s.end()); | |
set<char> A; int cont = 0; | |
for(int i=0; i<size(s); i++) { | |
res++; | |
if(A.size() == size(T)) break; | |
if(A.count(s[i])) continue; | |
set<char> B; | |
for(int j=i+1; j<size(s); j++) { | |
res++; | |
if(B.size() == size(T)) break; | |
if(B.count(s[j])) continue; | |
set<char> C; | |
for(int k=j+1; k<size(s); k++) { | |
res++; | |
if(C.size() == size(T)) break; | |
if(C.count(s[k])) continue; | |
cont++; | |
C.insert(s[k]); | |
} | |
B.insert(s[j]); | |
} | |
A.insert(s[i]); | |
} | |
cout << cont << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment