- 被优化掉的Shenchuan
为啥我cpeditor过了这个过不了啊,是环境问题吗
- @ 2025-3-13 20:43:57
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
signed main()
{
int n;cin>>n;
cin.ignore();
string s;
string sub;
sub="shenchuan";
getline(cin,s);
int cnt=0;
size_t first=s.find(sub);
if(s.find(sub)==string::npos)
{
cout<<0;
return 0;
}
else
{
size_t tmp=first;
while(tmp!=string::npos)
{
cnt++;
tmp=s.find(sub,tmp+1);
}
cout<<cnt<<endl;
}
size_t tmp=first;
while(tmp!=string::npos)
{
cout<<tmp<<' ';
tmp=s.find(sub,tmp+1);
}
return 0;
}
0 条评论
目前还没有评论...
信息
- ID
- 55
- 时间
- ms
- 内存
- MiB
- 难度
- 1
- 标签
- (无)
- 递交数
- 73
- 已通过
- 120
- 上传者