| 比赛 |
期末考试0 |
评测结果 |
AWWWWWWWWW |
| 题目名称 |
学姐的下午茶 |
最终得分 |
10 |
| 用户昵称 |
梦那边的美好BP |
运行时间 |
0.028 s |
| 代码语言 |
C++ |
内存使用 |
3.71 MiB |
| 提交时间 |
2026-02-07 11:15:19 |
显示代码纯文本
#include <iostream>
using namespace std;
int tr[2003][3], cnt = 1;
void ins(string s) {
int now = 1;
for (auto i : s) {
if (i == '?') i = '2';
if (!tr[now][i - '0']) {
cnt++;
tr[now][i - '0'] = cnt;
}
now = tr[now][i - '0'];
}
}
int main() {
freopen("lowtea.in", "r", stdin);
freopen("lowtea.out", "w", stdout);
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
ins(s);
}
cout << cnt;
return 0;
}
/*#include <iostream>
using namespace std;
int tr[2003][3], cnt = 1;
void ins(string s) {
int now = 1;
for (auto i : s) {
if (i == '?') i = '2';
if (!tr[now][i - '0']) {
cnt++;
tr[now][i - '0'] = cnt;
}
now = tr[now][i - '0'];
}
}
int ans = 0;
int sz[2003];
void dfs(int x) {
sz[x] = 1;
for (int i = 0; i <= 2; i++) {
if (tr[x][i]) {
dfs(tr[x][i]);
sz[x] += tr[x][i];
}
}
}
int c = 0;
void f(int x, int y) {
for (int i = 0; i <= 2; i++) {
if (!tr[x][i] && tr[y][i]) {
c += sz[tr[y][i]];
}
}
}
void s(int x) {
if (tr[x][2]) {
}
}
int main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
string s;
cin >> s;
ins(s);
}
cout << cnt;
return 0;
}*/