3 条评论

  • @ 2026-1-11 14:54:19

    666

    • #include <bits/stdc++.h>
      #include <string>
      using namespace std;
      #define ll long long
      #define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
      int t,n,k,i,sum;
      string a;
      int main(){
      	cin>>t;
      	while(t--){
      		sum=0;
      		cin>>n>>k;
      		cin>>a;
      		while(a.front()!='a' && k>0){
      			a.push_back(a.front());
      			a.erase(0,1);
      			k--;
      		}
      		for(int i=0;i<n;i++)
      			if(a[i]=='a')sum+=(a.substr(i,5)=="apple");
      		cout<<sum<<endl;
      	}
      	return 0;
      }
      /*
      3
      5 1
      eappl
      10 0
      eappleappl
      15 3
      pleappleappleap
      */```
        • 1

        信息

        ID
        767
        时间
        1000ms
        内存
        256MiB
        难度
        10
        标签
        (无)
        递交数
        256
        已通过
        8
        上传者