| 比赛 |
期末考试0 |
评测结果 |
AWWWWWWWWW |
| 题目名称 |
学姐的下午茶 |
最终得分 |
10 |
| 用户昵称 |
王潇翊 |
运行时间 |
0.028 s |
| 代码语言 |
C++ |
内存使用 |
3.69 MiB |
| 提交时间 |
2026-02-07 09:51:10 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
const int N = 107;
int n;
long long ans;
struct S
{
int b[N];
int s;
}a[N];
bool cmp(S x,S y)
{
for (int i = 1;i <= min(x.s,y.s);i++)
{
if (x.b[i] != y.b[i])
{
return x.b[i] < y.b[i];
}
}
return x.s < y.s;
}
int main()
{
freopen("lowtea.in","r",stdin);
freopen("lowtea.out","w",stdout);
cin >> n;
for (int i = 1;i <= n;i++)
{
string t;
cin >> t;
a[i].s = t.size();
for (int j = 0;j < t.size();j++)
{
a[i].b[j + 1] = t[j] - '0';
}
}
sort (a + 1,a + n + 1,cmp);
ans += a[1].s;
for (int i = 2;i <= n;i++)
{
for (int j = 1;j <= a[i].s;j++)
{
if (j > a[i - 1].s || a[i].b[j] != a[i - 1].b[j])
{
ans += a[i].s - j + 1;
break;
}
}
}
cout << ans + 1;
return 0;
}