-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP135SUMG.cpp
More file actions
83 lines (75 loc) · 1.53 KB
/
P135SUMG.cpp
File metadata and controls
83 lines (75 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Back track
#include<bits/stdc++.h>
using namespace std;
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Ford(i, a, b) for(int i = a; i >= b; i--)
#define ll long long
#define here cout<<"i am here"<<endl;
const long long base= 1e9 + 7;
const int maxn = 1000000;
string s;
int key[11], res1 = 0, a[103];
long long ans = 0;
int test(string s){
int resx = 0, resy = 0, resz = 0;
For(i, 0, s.length() - 1){
if(s[i] == 'U' || s[i] == 'E' || s[i] == 'O' || s[i] == 'A' || s[i] == 'I'){
resx++;
resy = 0;
}
else{
resy++;
resx = 0;
}
if(s[i] == 'L') resz++;
if(resx >= 3) return 0;
if(resy >= 3) return 0;
}
if(resz == 0) return 0;
return 1;
}
void space(){
For(i, 0, s.length() - 1){
if(s[i] == '_'){
res1++;
key[res1] = i;
}
}
}
void Bt(int i){
For(j, 0, 2){
string x = s;
a[key[i]] = j;
if(i == res1){
long long t1 = 0, t2 = 0;
For(k, 1, res1){
if(a[key[k]] == 0){
x[key[k]] = 'A';
t1++;
}
if(a[key[k]] == 1){
x[key[k]] = 'B';
t2++;
}
if(a[key[k]] == 2){
x[key[k]] = 'L';
}
}
if(test(x) == 1){
if(t1 == 0 && t2 == 0) ans += 1;
if(t1 == 0 && t2 != 0) ans += pow(20, t2);
if(t1 != 0 && t2 == 0) ans += pow(5, t1);
if(t1 != 0 && t2 != 0) ans += pow(5, t1) * pow(20, t2);
}
}
else Bt(i + 1);
}
}
int main(void){
ios::sync_with_stdio(false);
cin>>s;
space();
Bt(1);
cout<<ans;
return 0;
}