求助蒟蒻
  • 板块学术版
  • 楼主Qiu_chen
  • 当前回复8
  • 已保存回复8
  • 发布时间2022/10/23 15:04
  • 上次更新2023/10/27 06:18:33
查看原帖
求助蒟蒻
769128
Qiu_chen楼主2022/10/23 15:04
#include<bits/stdc++.h>
using namespace std;

void solve(){
	int n,i;
    char c;
    cin >> n >> c;
    string s;
    cin >> s;
    int mx = 0, last = 0;
    for(int i = 2 * n; i >= 1 ; i -- ) {
        if(s[i] == 'g') last = i;
        if(s[i] == 'c') mx = max(mx, last - i);
    }
    cout << mx << endl;
}
int main(){
	ios::sync_with_stdio(false),cin.tie(),cout.tie();
    int y;
    cin>>y;
    for(int b=1;b<=y;++b) solve();
    return 0;
}

话说为啥错? cf 1744 c

2022/10/23 15:04
加载中...