比赛 CSP2023-J模拟赛 评测结果 RRRRRRRRRRRRRRRRRRRR
题目名称 切分子串 最终得分 0
用户昵称 HXF 运行时间 0.009 s
代码语言 C++ 内存使用 5.74 MiB
提交时间 2023-10-18 17:21:15
显示代码纯文本
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n,ans;
  4.  
  5. string s,t;
  6.  
  7. inline int read(){
  8. int t=0,f=1;
  9. register char c=getchar();
  10. while(c<'0'||c>'9') f=(c=='-')?(-1):(f),c=getchar();
  11. while(c>='0'&&c<='9') t=(t<<3)+(t<<1)+(c^48),c=getchar();
  12. return t*f;
  13. }
  14.  
  15. int main(){
  16. // freopen(".in","r",stdin);
  17. // freopen(".out","w",stdout);
  18. cin>>s>>t;
  19. for(int i=1;i<t.size();i++){
  20. string a=t.substr(0,i),b=t.substr(i,t.size()-i);
  21. if(s.find(a)<s.size()&&s.find(b)<s.size()) ans++;
  22. }
  23. printf("%d",ans);
  24. return 0;
  25. }
  26.