比赛 |
NOIP模拟赛1 |
评测结果 |
WWWWWWWWWW |
题目名称 |
叉叉 |
最终得分 |
0 |
用户昵称 |
LYN-- |
运行时间 |
0.096 s |
代码语言 |
C++ |
内存使用 |
0.19 MiB |
提交时间 |
2018-02-08 21:11:09 |
显示代码纯文本
- #include<iostream>
- #include<cstdio>
- #include<cstring>
- using namespace std;
- int ans;
- int main()
- {
- freopen("xxxx.in","r",stdin);
- freopen("xxxx.out","w",stdout);
- int lg;
- string sd;
- cin>>sd;
- lg=sd.length();
- int am[200],jh[200];
- for(char ch='a';ch<='z';ch++)
- am[ch]=0;
- for(char sh='a';sh<='z';sh++)
- jh[sh]=0;
- for(int i=0;i<lg;i++)
- {
- if(am[sd[i]]==0)
- {
- am[sd[i]]=1;
- jh[sd[i]]=i;
- }
- else
- {
- for(int j=jh[sd[i]]+1;j<i;j++)
- {
- if(am[sd[j]]==1)
- ans++;
- }
- am[sd[i]]=0;
- }
-
- }
- cout<<ans;
- }